diff options
| author | ali-aqrabawi <aaqrabaw@okdanetworks.com> | 2024-02-03 23:57:13 +0300 |
|---|---|---|
| committer | ali-aqrabawi <aaqrabaw@okdanetworks.com> | 2024-02-03 23:57:13 +0300 |
| commit | cfe1b5b684804a2c8411fd720ea2fb7afd299d0e (patch) | |
| tree | 121702c2b2db99757ebace976761127cc6342323 /lib/northbound_sysrepo.c | |
| parent | a2caf2b5e132ad6d50d83348d8efe9cdea72ec6e (diff) | |
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 <aaqrabaw@okdanetworks.com>
Diffstat (limited to 'lib/northbound_sysrepo.c')
| -rw-r--r-- | lib/northbound_sysrepo.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 198d96e381..4942d66850 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); |
