cli_auto_edit: Fix data below mountpoint cannot be edited
Without this fix, every edit affects the mountpoint destination module directly instead of the same module inside of its mountpoint container.
This commit is contained in:
parent
34fff6c270
commit
60fdb65ee0
2 changed files with 23 additions and 6 deletions
|
|
@ -119,6 +119,7 @@ cli_auto_edit(clixon_handle h,
|
|||
{
|
||||
int retval = -1;
|
||||
char *api_path_fmt; /* xml key format */
|
||||
char *api_path_fmt01 = NULL;
|
||||
char *api_path = NULL;
|
||||
char *treename;
|
||||
pt_head *ph;
|
||||
|
|
@ -177,9 +178,18 @@ cli_auto_edit(clixon_handle h,
|
|||
clixon_err(OE_YANG, EINVAL, "No apipath found");
|
||||
goto done;
|
||||
}
|
||||
/* get api-path and xpath */
|
||||
if (api_path_fmt2api_path(api_path_fmt, cvv2, yspec0, &api_path, NULL) < 0)
|
||||
goto done;
|
||||
if (mtpoint){
|
||||
/* Get and combine api-path01 */
|
||||
if (mtpoint_paths(yspec0, mtpoint, api_path_fmt, &api_path_fmt01) < 0)
|
||||
goto done;
|
||||
if (api_path_fmt2api_path(api_path_fmt01, cvv2, yspec0, &api_path, NULL) < 0)
|
||||
goto done;
|
||||
}
|
||||
else{
|
||||
/* get api-path and xpath */
|
||||
if (api_path_fmt2api_path(api_path_fmt, cvv2, yspec0, &api_path, NULL) < 0)
|
||||
goto done;
|
||||
}
|
||||
/* Store this as edit-mode */
|
||||
if (clicon_data_set(h, "cli-edit-mode", api_path) < 0)
|
||||
goto done;
|
||||
|
|
@ -204,6 +214,8 @@ cli_auto_edit(clixon_handle h,
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
if (api_path_fmt01)
|
||||
free(api_path_fmt01);
|
||||
if (mtpoint2)
|
||||
free(mtpoint2);
|
||||
if (api_path)
|
||||
|
|
|
|||
|
|
@ -1236,8 +1236,7 @@ cli_show_auto_mode(clixon_handle h,
|
|||
if (yang_mount_get(yu, mtpoint, &yspec) < 0)
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
yspec = yspec0;
|
||||
yspec = yspec0;
|
||||
if (api_path2xpath(api_path, yspec, &xpath, &nsc, NULL) < 0)
|
||||
goto done;
|
||||
if (xpath == NULL){
|
||||
|
|
@ -1249,7 +1248,13 @@ cli_show_auto_mode(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
if (mtpoint){
|
||||
cprintf(cbxpath, "%s", mtpoint);
|
||||
/*
|
||||
* XXX disabled the line below, because otherwise the path up to the
|
||||
* mount point would be added twice to cbxpath. This is because the
|
||||
* api_path and thus also the xpath already include the path up to the
|
||||
* mount point. (at least since cli_auto_edit() was changed)
|
||||
*/
|
||||
//cprintf(cbxpath, "%s", mtpoint);
|
||||
if (xml_nsctx_yangspec(yspec0, &nsc0) < 0)
|
||||
goto done;
|
||||
cv = NULL; /* Append cvv1 to cvv2 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue