* Invalid key to api_path2xml gives warning instead of error and quit.
This commit is contained in:
parent
990700b68d
commit
ac7480b9f5
3 changed files with 7 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
### Major changes:
|
### Major changes:
|
||||||
### Minor changes:
|
### Minor changes:
|
||||||
|
* Invalid key to api_path2xml gives warning instead of error and quit.
|
||||||
* yang_find_topnode() and api_path2xml() schemanode parameter replaced with yang_class. Replace as follows: 0 -> YC_DATANODE, 1 -> YC_SCHEMANODE
|
* yang_find_topnode() and api_path2xml() schemanode parameter replaced with yang_class. Replace as follows: 0 -> YC_DATANODE, 1 -> YC_SCHEMANODE
|
||||||
|
|
||||||
* xml2json: include prefix in translation, so <a:b> is translated to {"a:b" ..}
|
* xml2json: include prefix in translation, so <a:b> is translated to {"a:b" ..}
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,8 @@ expand_dbvar(void *h,
|
||||||
*/
|
*/
|
||||||
if (api_path && api_path2xml(api_path, yspec, xtop, YC_DATANODE, &xbot, &y) < 0)
|
if (api_path && api_path2xml(api_path, yspec, xtop, YC_DATANODE, &xbot, &y) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
if (y==NULL)
|
||||||
|
goto ok;
|
||||||
/* Special case for leafref. Detect leafref via Yang-type,
|
/* Special case for leafref. Detect leafref via Yang-type,
|
||||||
* Get Yang path element, tentatively add the new syntax to the whole
|
* Get Yang path element, tentatively add the new syntax to the whole
|
||||||
* tree and apply the path to that.
|
* tree and apply the path to that.
|
||||||
|
|
@ -236,6 +238,7 @@ expand_dbvar(void *h,
|
||||||
/* XXX RFC3986 decode */
|
/* XXX RFC3986 decode */
|
||||||
cvec_add_string(commands, NULL, bodystr);
|
cvec_add_string(commands, NULL, bodystr);
|
||||||
}
|
}
|
||||||
|
ok:
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
if (api_path)
|
if (api_path)
|
||||||
|
|
|
||||||
|
|
@ -1614,8 +1614,8 @@ api_path2xml(char *api_path,
|
||||||
int nvec;
|
int nvec;
|
||||||
|
|
||||||
if (*api_path!='/'){
|
if (*api_path!='/'){
|
||||||
clicon_err(OE_DB, 0, "Invalid key: %s", api_path);
|
clicon_log(LOG_WARNING, "Invalid key: %s (must start with '/')", api_path);
|
||||||
goto done;
|
goto ok;
|
||||||
}
|
}
|
||||||
if ((vec = clicon_strsep(api_path, "/", &nvec)) == NULL)
|
if ((vec = clicon_strsep(api_path, "/", &nvec)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -1631,6 +1631,7 @@ api_path2xml(char *api_path,
|
||||||
xtop, (yang_node*)yspec, nodeclass,
|
xtop, (yang_node*)yspec, nodeclass,
|
||||||
xbotp, ybotp) < 0)
|
xbotp, ybotp) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
ok:
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
if (vec)
|
if (vec)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue