diff --git a/CHANGELOG.md b/CHANGELOG.md index a0abaae8..454eb645 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Clixon Changelog +* Fixed bug that deletes running on startup if backup started with -m running. + When clixon starts again, running is lost. + The error was that the running (or startup) configuration may fail when + clixon backend starts. + The fix now makes a copy of running and copies it back on failure + ## 3.3.3 (25 November 2017) Thanks to Matthew Smith, Joe Loeliger at Netgate; Fredrik Pettai at diff --git a/apps/backend/backend_main.c b/apps/backend/backend_main.c index f65bf6c5..0f80d0d1 100644 --- a/apps/backend/backend_main.c +++ b/apps/backend/backend_main.c @@ -536,8 +536,13 @@ startup_mode_running(clicon_handle h, if (load_extraxml(h, extraxml_file, "tmp") < 0) goto done; /* Commit original running */ - if (candidate_commit(h, "candidate") < 0) + if (candidate_commit(h, "candidate") < 0){ + clicon_log(LOG_NOTICE, "%s: Commit of saved running failed, exiting.", __FUNCTION__); + /* Reinstate original */ + if (xmldb_copy(h, "candidate", "running") < 0) + goto done; goto done; + } /* Merge user reset state and extra xml file (no commit) */ if (db_merge(h, "tmp", "running") < 0) goto done;