Skip to content

Commit

Permalink
lib: set change errmsg in sysrepo session
Browse files Browse the repository at this point in the history
this will enable sysrepo based cli users to know what went wrong
when config change fails

Signed-off-by: ali-aqrabawi <[email protected]>
  • Loading branch information
Ali-aqrabawi committed Feb 3, 2024
1 parent a2caf2b commit cfe1b5b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/northbound_sysrepo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cfe1b5b

Please sign in to comment.