* [Delete and show config are oblivious to the leaf value #157](https://github.com/clicon/clixon/issues/157)

* Added equality of values necessary condition in edit-config delete/remove of leafs
This commit is contained in:
Olof hagsand 2020-12-16 15:45:17 +01:00
parent 8bc81a8e42
commit 2b820e153a
7 changed files with 38 additions and 16 deletions

View file

@ -465,8 +465,20 @@ text_modify(clicon_handle h,
if (ret == 0)
goto fail;
}
if (xml_purge(x0) < 0)
goto done;
x0bstr = xml_body(x0);
/* Purge if x1 value is NULL(match-all) or both values are equal */
if ((x1bstr == NULL) ||
((x0bstr=xml_body(x0)) != NULL && strcmp(x0bstr, x1bstr)==0)){
if (xml_purge(x0) < 0)
goto done;
}
else {
if (op == OP_DELETE){
if (netconf_data_missing(cbret, NULL, "Data does not exist; cannot delete resource") < 0)
goto done;
goto fail;
}
}
}
break;
default:
@ -540,7 +552,7 @@ text_modify(clicon_handle h,
} /* OP_MERGE & insert */
case OP_NONE: /* fall thru */
/* Special case: anyxml, just replace tree,
See rfc6020 7.10.3:n
See rfc6020 7.10.3
An anyxml node is treated as an opaque chunk of data. This data
can be modified in its entirety only.
Any "operation" attributes present on subelements of an anyxml