Skip to content

Commit

Permalink
netconf BUGFIX copy-config data upload for url
Browse files Browse the repository at this point in the history
NACM should be applied. Setting the config variable applies only to url
upload.
  • Loading branch information
lePici authored and michalvasko committed Apr 12, 2024
1 parent a349281 commit ab61f22
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/netconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,6 @@ np2srv_rpc_copyconfig_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), con
goto cleanup;
}

if (!source_is_config && !run_to_start) {
/* get source datastore data */
sr_session_switch_ds(session, sds);
if ((rc = sr_get_data(session, "/*", 0, np2srv.sr_timeout, 0, &sr_data))) {
goto cleanup;
}
config = sr_data->tree;
sr_data->tree = NULL;
sr_release_data(sr_data);
}

/* get the user session */
if ((rc = np_find_user_sess(session, __func__, &nc_sess, &user_sess))) {
goto cleanup;
Expand All @@ -451,6 +440,18 @@ np2srv_rpc_copyconfig_cb(sr_session_ctx_t *session, uint32_t UNUSED(sub_id), con
if (trg_url) {
struct lyd_node *node;

if (!source_is_config) {
/* get source datastore data */
sr_session_switch_ds(user_sess->sess, sds);
if ((rc = sr_get_data(user_sess->sess, "/*", 0, np2srv.sr_timeout, 0, &sr_data))) {
sr_session_dup_error(user_sess->sess, session);
goto cleanup;
}
config = sr_data->tree;
sr_data->tree = NULL;
sr_release_data(sr_data);
}

/* we need with-defaults flag in this case */
lyp_wd_flag = 0;
if (!lyd_find_path(input, "ietf-netconf-with-defaults:with-defaults", 0, &node)) {
Expand Down

0 comments on commit ab61f22

Please sign in to comment.