restconf PUT delta
This commit is contained in:
parent
cd33380368
commit
f6284ac933
2 changed files with 11 additions and 9 deletions
|
|
@ -587,12 +587,13 @@ api_data_put(clicon_handle h,
|
||||||
if ((xa = xml_new("operation", x, NULL)) == NULL)
|
if ((xa = xml_new("operation", x, NULL)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
xml_type_set(xa, CX_ATTR);
|
xml_type_set(xa, CX_ATTR);
|
||||||
if (xml_value_set(xa, xml_operation2str(op)) < 0)
|
if (xml_value_set(xa, xml_operation2str(op)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
/* Replace xbot with x */
|
/* XXX Special case path=/restconf/data xml_name(x) == data */
|
||||||
|
/* Replace xbot with x */
|
||||||
xp = xml_parent(xbot);
|
xp = xml_parent(xbot);
|
||||||
xml_purge(xbot);
|
xml_purge(xbot);
|
||||||
if (xml_addsub(xp, x) < 0)
|
if (xml_addsub(xp, x) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((cbx = cbuf_new()) == NULL)
|
if ((cbx = cbuf_new()) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -605,7 +606,6 @@ api_data_put(clicon_handle h,
|
||||||
notfound(r);
|
notfound(r);
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clicon_rpc_validate(h, "candidate") < 0){
|
if (clicon_rpc_validate(h, "candidate") < 0){
|
||||||
if (clicon_rpc_discard_changes(h) < 0)
|
if (clicon_rpc_discard_changes(h) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -595,7 +595,7 @@ xml_find(cxobj *x_up,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Append xc as child to xp. Remove xc from previous parent.
|
/*! Append xc as child to xp. Remove xc from previous parent.
|
||||||
* @param[in] xp Parent xml node
|
* @param[in] xp Parent xml node. If NULL just remove from old parent.
|
||||||
* @param[in] xc Child xml node to insert under xp
|
* @param[in] xc Child xml node to insert under xp
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
* @retval -1 Error
|
* @retval -1 Error
|
||||||
|
|
@ -618,10 +618,12 @@ xml_addsub(cxobj *xp,
|
||||||
xml_child_rm(oldp, i);
|
xml_child_rm(oldp, i);
|
||||||
}
|
}
|
||||||
/* Add xc to new parent */
|
/* Add xc to new parent */
|
||||||
if (xml_child_append(xp, xc) < 0)
|
if (xp){
|
||||||
return -1;
|
if (xml_child_append(xp, xc) < 0)
|
||||||
/* Set new parent in child */
|
return -1;
|
||||||
xml_parent_set(xc, xp);
|
/* Set new parent in child */
|
||||||
|
xml_parent_set(xc, xp);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue