* minor edits make datastore=nocache pass tests, and ensure generic copy-config works
This commit is contained in:
parent
99c570e278
commit
a71e8aaceb
6 changed files with 62 additions and 48 deletions
|
|
@ -231,8 +231,9 @@ xmldb_copy(clicon_handle h,
|
|||
if (de2)
|
||||
de0 = *de2;
|
||||
de0.de_xml = x2; /* The new tree */
|
||||
clicon_db_elmnt_set(h, to, &de0);
|
||||
}
|
||||
clicon_db_elmnt_set(h, to, &de0);
|
||||
|
||||
/* Copy the files themselves (above only in-memory cache) */
|
||||
if (xmldb_db2file(h, from, &fromfile) < 0)
|
||||
goto done;
|
||||
|
|
@ -382,12 +383,10 @@ xmldb_clear(clicon_handle h,
|
|||
cxobj *xt = NULL;
|
||||
db_elmnt *de = NULL;
|
||||
|
||||
if (clicon_datastore_cache(h) != DATASTORE_NOCACHE){
|
||||
if ((de = clicon_db_elmnt_get(h, db)) != NULL){
|
||||
if ((xt = de->de_xml) != NULL){
|
||||
xml_free(xt);
|
||||
de->de_xml = NULL;
|
||||
}
|
||||
if ((de = clicon_db_elmnt_get(h, db)) != NULL){
|
||||
if ((xt = de->de_xml) != NULL){
|
||||
xml_free(xt);
|
||||
de->de_xml = NULL;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -439,12 +438,10 @@ xmldb_create(clicon_handle h,
|
|||
db_elmnt *de = NULL;
|
||||
cxobj *xt = NULL;
|
||||
|
||||
if (clicon_datastore_cache(h) != DATASTORE_NOCACHE){
|
||||
if ((de = clicon_db_elmnt_get(h, db)) != NULL){
|
||||
if ((xt = de->de_xml) != NULL){
|
||||
xml_free(xt);
|
||||
de->de_xml = NULL;
|
||||
}
|
||||
if ((de = clicon_db_elmnt_get(h, db)) != NULL){
|
||||
if ((xt = de->de_xml) != NULL){
|
||||
xml_free(xt);
|
||||
de->de_xml = NULL;
|
||||
}
|
||||
}
|
||||
if (xmldb_db2file(h, db, &filename) < 0)
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ parse_configfile_one(const char *filename,
|
|||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] filename Main configuration file
|
||||
* @param[in] extraconfig0 Override (if set use that, othewrwise get from main file)
|
||||
* @param[in] extraconfig0 Override (if set use that, otherwise get from main file)
|
||||
* @param[in] yspec Yang spec
|
||||
* @param[out] xconfig Pointer to xml config tree. Should be freed by caller
|
||||
* @retval 0 OK
|
||||
|
|
@ -335,10 +335,13 @@ parse_configfile(clicon_handle h,
|
|||
while ((xec = xml_child_i_type(xe, 0, CX_ELMNT)) != NULL) {
|
||||
name = xml_name(xec);
|
||||
body = xml_body(xec);
|
||||
/* Ignore non-leafs */
|
||||
if (name == NULL || body == NULL)
|
||||
continue;
|
||||
/* Ignored from file due to bootstrapping */
|
||||
if (strcmp(name,"CLICON_CONFIGFILE")==0)
|
||||
continue;
|
||||
/* List options for configure options that are leaf-lists: append to main */
|
||||
/* List options for configure options that are lists or leaf-lists: append to main */
|
||||
if (strcmp(name,"CLICON_FEATURE")==0 ||
|
||||
strcmp(name,"CLICON_YANG_DIR")==0){
|
||||
if (xml_addsub(xt, xec) < 0)
|
||||
|
|
@ -375,7 +378,7 @@ parse_configfile(clicon_handle h,
|
|||
while ((x = xml_child_each(xt, x, CX_ELMNT)) != NULL) {
|
||||
name = xml_name(x);
|
||||
body = xml_body(x);
|
||||
/* Ignored non-leafs */
|
||||
/* Ignore non-leafs */
|
||||
if (name == NULL || body == NULL)
|
||||
continue;
|
||||
/* Ignored from file due to bootstrapping */
|
||||
|
|
@ -388,7 +391,6 @@ parse_configfile(clicon_handle h,
|
|||
continue;
|
||||
if (strcmp(name,"CLICON_YANG_DIR")==0)
|
||||
continue;
|
||||
|
||||
if (clicon_hash_add(copt,
|
||||
name,
|
||||
body,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue