Add -s dump-xml mode
This commit is contained in:
parent
79fac840ba
commit
d1b8dcdf1f
3 changed files with 12 additions and 5 deletions
|
|
@ -906,8 +906,8 @@ main(int argc,
|
|||
/* [Delete and] create running db */
|
||||
if (xmldb_db_reset(h, "running") < 0)
|
||||
goto done;
|
||||
case SM_NONE: /* Fall through *
|
||||
* Load plugins and call plugin_init() */
|
||||
/* FALLTHRU */
|
||||
case SM_NONE: /* Load plugins and call plugin_init() */
|
||||
if ((ret = startup_extraxml(h, NULL, cbret)) < 0)
|
||||
goto done;
|
||||
status = STARTUP_OK;
|
||||
|
|
@ -941,7 +941,12 @@ main(int argc,
|
|||
goto done;
|
||||
/* if status = STARTUP_INVALID, cbret contains info */
|
||||
break;
|
||||
default:;
|
||||
case SM_DUMP_XML:
|
||||
/* dump the tree */
|
||||
cxobj *xc = clicon_conf_xml(h);
|
||||
ret = clixon_xml2file(stdout, xc, 0, 1, "", &fprintf, 0, 1);
|
||||
goto ok;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* Quit after upgrade catch-all, running/startup quits in upgrade code */
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ enum startup_mode_t{
|
|||
SM_INIT, /* Initialize running state */
|
||||
SM_RUNNING, /* Commit running db configuration into running state */
|
||||
SM_STARTUP, /* Commit startup configuration into running state */
|
||||
SM_RUNNING_STARTUP /* First try running db, if it is empty try startup db */
|
||||
SM_RUNNING_STARTUP, /* First try running db, if it is empty try startup db */
|
||||
SM_DUMP_XML /* Dump XML configuration to stdout and exit */
|
||||
};
|
||||
|
||||
/*! See clixon-config.yang type priv_mode (privileges mode) */
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ static const map_str2int startup_mode_map[] = {
|
|||
{"running", SM_RUNNING},
|
||||
{"startup", SM_STARTUP},
|
||||
{"running-startup", SM_RUNNING_STARTUP},
|
||||
{"dump-xml", SM_DUMP_XML},
|
||||
{NULL, -1}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue