* Added new startup-mode: running-startup: First try running db, if it is empty try startup db.
* See [Can startup mode to be extended to support running-startup mode? #234](https://github.com/clicon/clixon/issues/234) * Improved error message on failed MUST condition
This commit is contained in:
parent
69af2884d0
commit
e0c3f5467c
7 changed files with 34 additions and 10 deletions
|
|
@ -854,17 +854,24 @@ main(int argc,
|
|||
goto done;
|
||||
}
|
||||
/* Check that netconf :startup is enabled */
|
||||
if (startup_mode == SM_STARTUP &&
|
||||
if ((startup_mode == SM_STARTUP || startup_mode == SM_RUNNING_STARTUP) &&
|
||||
!if_feature(yspec, "ietf-netconf", "startup")){
|
||||
clicon_log(LOG_ERR, "Startup mode selected but Netconf :startup feature is not enabled. Enable with option: <CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Init running db if it is not there
|
||||
* change running_startup -> running or startup depending on if running exists or not
|
||||
*/
|
||||
if (xmldb_exists(h, "running") != 1)
|
||||
if (xmldb_exists(h, "running") != 1){
|
||||
if (startup_mode == SM_RUNNING_STARTUP)
|
||||
startup_mode = SM_STARTUP;
|
||||
if (xmldb_create(h, "running") < 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
if (startup_mode == SM_RUNNING_STARTUP)
|
||||
startup_mode = SM_RUNNING;
|
||||
xmldb_delete(h, "candidate");
|
||||
/* If startup fails, lib functions report invalidation info in a cbuf */
|
||||
if ((cbret = cbuf_new()) == NULL){
|
||||
|
|
@ -909,6 +916,9 @@ main(int argc,
|
|||
if (ret2status(ret, &status) < 0)
|
||||
goto done;
|
||||
/* if status = STARTUP_INVALID, cbret contains info */
|
||||
break;
|
||||
default:;
|
||||
break;
|
||||
}
|
||||
/* Quit after upgrade catch-all, running/startup quits in upgrade code */
|
||||
if (clicon_quit_upgrade_get(h) == 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue