Use <config> instead of <data> when save/load configuration
This commit is contained in:
parent
67f4478f76
commit
2acacbf087
1 changed files with 9 additions and 0 deletions
|
|
@ -829,10 +829,19 @@ save_config_file(clicon_handle h,
|
||||||
filename = cv_string_get(cv);
|
filename = cv_string_get(cv);
|
||||||
if (clicon_rpc_get_config(h, dbstr,"/", NULL, &xt) < 0)
|
if (clicon_rpc_get_config(h, dbstr,"/", NULL, &xt) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
if (xt == NULL){
|
||||||
|
clicon_err(OE_CFG, 0, "get config: empty tree"); /* Shouldnt happen */
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
if ((xerr = xpath_first(xt, "/rpc-error")) != NULL){
|
if ((xerr = xpath_first(xt, "/rpc-error")) != NULL){
|
||||||
clicon_rpc_generate_error("Get configuration", xerr);
|
clicon_rpc_generate_error("Get configuration", xerr);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
/* get-config returns a <data> tree. Save as <config> tree so it can be used
|
||||||
|
* as data-store.
|
||||||
|
*/
|
||||||
|
if (xml_name_set(xt, "config") < 0)
|
||||||
|
goto done;
|
||||||
if ((f = fopen(filename, "w")) == NULL){
|
if ((f = fopen(filename, "w")) == NULL){
|
||||||
clicon_err(OE_CFG, errno, "Creating file %s", filename);
|
clicon_err(OE_CFG, errno, "Creating file %s", filename);
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue