From f0c82017625312ea099b0a6604339591509cc6f6 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Mon, 3 Oct 2022 10:29:28 +0200 Subject: [PATCH] Added warning if modstate is not present in datastore if is set --- CHANGELOG.md | 4 ++++ apps/backend/backend_commit.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27cb1f34..d7379f90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,10 @@ Developers may need to change their code * C API changes * Added `defaults` parameter to `clicon_rpc_get_pageable_list()` +### Minor features + +* Added warning if modstate is not present in datastore if `CLICON_XMLDB_MODSTATE` is set. + ### Corrected Bugs * Fixed: [message-id present on netconf app "hello"](https://github.com/clicon/clixon/issues/369) diff --git a/apps/backend/backend_commit.c b/apps/backend/backend_commit.c index 969ba75f..d6326d3c 100644 --- a/apps/backend/backend_commit.c +++ b/apps/backend/backend_commit.c @@ -200,6 +200,11 @@ startup_common(clicon_handle h, if (xmldb_get0(h, db, YB_NONE, NULL, "/", 0, &xt, msdiff, &xerr) < 0) goto done; } + if (msdiff && msdiff->md_status == 0){ // Possibly check for CLICON_XMLDB_MODSTATE + clicon_log(LOG_WARNING, "Modstate expected in startup datastore but not found\n" + "This may indicate that the datastore is not initialized corrrectly, such as copy/pasted.\n" + "It may also be normal bootstrapping since module state will be written on next datastore save"); + } if ((yspec = clicon_dbspec_yang(h)) == NULL){ clicon_err(OE_YANG, 0, "Yang spec not set"); goto done;