State callback error message changed to include namespace and use proper <bad-element>

This commit is contained in:
Olof hagsand 2019-12-21 20:50:55 +01:00
parent 7ad16bd84b
commit b78054e7cf
4 changed files with 38 additions and 14 deletions

View file

@ -134,19 +134,25 @@ clixon_plugin_statedata(clicon_handle h,
if (ret > 0 && (ret = xml_yang_validate_add(h, x, &xerr)) < 0)
goto done;
if (ret == 0){
if ((cberr = cbuf_new()) ==NULL){
clicon_err(OE_XML, errno, "cbuf_new");
goto done;
cxobj *xe;
cxobj *xb;
if ((xe = xpath_first(xerr, NULL, "//error-tag")) != NULL &&
(xb = xml_body_get(xe))){
if (xml_value_set(xb, "operation-failed") < 0)
goto done;
}
if ((xe = xpath_first(xerr, NULL, "//error-message")) != NULL &&
(xb = xml_body_get(xe))){
if (xml_value_append(xb, " Internal error, state callback returned invalid XML") < 0)
goto done;
}
cprintf(cberr, "Internal error: state callback returned invalid XML: ");
if (netconf_err2cb(xpath_first(xerr, NULL, "rpc-error"), cberr) < 0)
goto done;
if (*xret){
xml_free(*xret);
*xret = NULL;
}
if (netconf_operation_failed_xml(xret, "application", cbuf_get(cberr))< 0)
goto done;
*xret = xerr;
xerr = NULL;
goto fail;
}
#if 1