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 */
|
/* [Delete and] create running db */
|
||||||
if (xmldb_db_reset(h, "running") < 0)
|
if (xmldb_db_reset(h, "running") < 0)
|
||||||
goto done;
|
goto done;
|
||||||
case SM_NONE: /* Fall through *
|
/* FALLTHRU */
|
||||||
* Load plugins and call plugin_init() */
|
case SM_NONE: /* Load plugins and call plugin_init() */
|
||||||
if ((ret = startup_extraxml(h, NULL, cbret)) < 0)
|
if ((ret = startup_extraxml(h, NULL, cbret)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
status = STARTUP_OK;
|
status = STARTUP_OK;
|
||||||
|
|
@ -941,7 +941,12 @@ main(int argc,
|
||||||
goto done;
|
goto done;
|
||||||
/* if status = STARTUP_INVALID, cbret contains info */
|
/* if status = STARTUP_INVALID, cbret contains info */
|
||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
/* Quit after upgrade catch-all, running/startup quits in upgrade code */
|
/* 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_INIT, /* Initialize running state */
|
||||||
SM_RUNNING, /* Commit running db configuration into running state */
|
SM_RUNNING, /* Commit running db configuration into running state */
|
||||||
SM_STARTUP, /* Commit startup 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) */
|
/*! See clixon-config.yang type priv_mode (privileges mode) */
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ static const map_str2int startup_mode_map[] = {
|
||||||
{"running", SM_RUNNING},
|
{"running", SM_RUNNING},
|
||||||
{"startup", SM_STARTUP},
|
{"startup", SM_STARTUP},
|
||||||
{"running-startup", SM_RUNNING_STARTUP},
|
{"running-startup", SM_RUNNING_STARTUP},
|
||||||
|
{"dump-xml", SM_DUMP_XML},
|
||||||
{NULL, -1}
|
{NULL, -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue