System-only config: Source of truth

Candidate, fix system-only in cache when locked or modified, re-read otherwise
Remove system-only from cache after commit
This commit is contained in:
Olof hagsand 2024-10-31 09:22:27 +01:00
parent cfa4803e0f
commit 313a2caadd
16 changed files with 189 additions and 78 deletions

View file

@ -1030,16 +1030,9 @@ main(int argc,
/* Initiate the shared candidate. */
if (xmldb_copy(h, "running", "candidate") < 0)
goto done;
/* Add system-only config to candidate */
if (clicon_option_bool(h, "CLICON_XMLDB_SYSTEM_ONLY_CONFIG")){
cxobj *x;
if ((x = xmldb_cache_get(h, "candidate")) != NULL)
if (xmldb_system_only_config(h, "/", NULL, &x) < 0)
goto done;
}
if (xmldb_modified_set(h, "candidate", 0) <0)
goto done;
/* Set startup status */
if (clicon_startup_status_set(h, status) < 0)
goto done;