From cfe1b5b684804a2c8411fd720ea2fb7afd299d0e Mon Sep 17 00:00:00 2001 From: ali-aqrabawi Date: Sat, 3 Feb 2024 23:57:13 +0300 Subject: [PATCH] lib: set change errmsg in sysrepo session this will enable sysrepo based cli users to know what went wrong when config change fails Signed-off-by: ali-aqrabawi --- lib/northbound_sysrepo.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 198d96e3811c..4942d66850ec 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -279,11 +279,12 @@ static int frr_sr_config_change_cb_prepare(sr_session_ctx_t *session, ret = nb_candidate_commit_prepare(context, candidate, NULL, &transaction, false, false, errmsg, sizeof(errmsg)); - if (ret != NB_OK && ret != NB_ERR_NO_CHANGES) - flog_warn( - EC_LIB_LIBSYSREPO, - "%s: failed to prepare configuration transaction: %s (%s)", - __func__, nb_err_name(ret), errmsg); + if (ret != NB_OK && ret != NB_ERR_NO_CHANGES) { + flog_warn(EC_LIB_LIBSYSREPO, + "%s: failed to prepare configuration transaction: %s (%s)", + __func__, nb_err_name(ret), errmsg); + sr_session_set_error_message(session, errmsg); + } if (!transaction) nb_config_free(candidate);