Changed (startup) running mode so that startup_db is not overwritten.

This changes the upgrade semantics for running mode which will have to
be accounted for later.
This commit is contained in:
Olof hagsand 2019-03-12 09:56:09 +01:00
parent b54e6c1cc0
commit 932ca2e8ce
5 changed files with 51 additions and 63 deletions

View file

@ -671,11 +671,15 @@ main(int argc,
break;
case SM_RUNNING: /* Use running as startup */
/* Copy original running to startup and treat as startup */
if (xmldb_copy(h, "running", "startup") < 0)
if (xmldb_copy(h, "running", "tmp") < 0)
goto done;
case SM_STARTUP: /* Fall through */
ret = startup_mode_startup(h, "tmp", cbret);
if (ret2status(ret, &status) < 0)
goto done;
break;
case SM_STARTUP:
/* Load and commit from startup */
ret = startup_mode_startup(h, cbret);
ret = startup_mode_startup(h, "startup", cbret);
if (ret2status(ret, &status) < 0)
goto done;
/* if status = STARTUP_INVALID, cbret contains info */

View file

@ -144,11 +144,11 @@ startup --+-------------------------------------> BROKEN XML
*/
int
startup_mode_startup(clicon_handle h,
char *db,
cbuf *cbret)
{
int retval = -1;
int ret;
char *db = "startup";
/* [Delete and] create running db */
if (startup_db_reset(h, "running") < 0)

View file

@ -41,7 +41,7 @@
* Prototypes
*/
int startup_db_reset(clicon_handle h, char *db);
int startup_mode_startup(clicon_handle h, cbuf *cbret);
int startup_mode_startup(clicon_handle h, char *db, cbuf *cbret);
int startup_extraxml(clicon_handle h, char *file, cbuf *cbret);
int startup_failsafe(clicon_handle h);
int startup_module_state(clicon_handle h, yang_spec *yspec);