From 02c461b84f8fb6d7dd4bdd289bf590646297c0cb Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Wed, 18 Dec 2019 23:27:19 +0100 Subject: [PATCH] Fixed CLI error messages on wrong cli_set/merge xml-key --- CHANGELOG.md | 2 ++ apps/cli/cli_common.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e82e5dfe..de9c6367 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,8 @@ a="urn:example:a" xmlns:b="urn:example:b"/>` * FreeBSD modifications: Configure, makefiles and test scripts modification for Freebsd ### Corrected Bugs +* Fixed CLI error messages on wrong cli_set/merge xml-key to eg: + * `Config error: api-path syntax error \"/example:x/m1=%s\": rpc malformed-message List key m1 length mismatch : Invalid argument"` * Hello netconf candidate capability misspelled, mentioned in [Can clixon_netconf receive netconf packets as a server? #93](https://github.com/clicon/clixon/issues/93) * [Cannot write to config using restconf example #91](https://github.com/clicon/clixon/issues/91) * Updated restconf documentation (the example was wrong) diff --git a/apps/cli/cli_common.c b/apps/cli/cli_common.c index 8a273cd4..d9488cb1 100644 --- a/apps/cli/cli_common.c +++ b/apps/cli/cli_common.c @@ -268,7 +268,14 @@ cli_dbxml(clicon_handle h, if ((ret = api_path2xml(api_path, yspec, xtop, YC_DATANODE, 1, &xbot, &y, &xerr)) < 0) goto done; if (ret == 0){ - clicon_rpc_generate_error("Modify datastore", xerr); + if ((cb = cbuf_new()) == NULL){ + clicon_err(OE_UNIX, errno, "cbuf_new"); + goto done; + } + cprintf(cb, "api-path syntax error \"%s\": ", api_path_fmt); + if (netconf_err2cb(xerr, cb) < 0) + goto done; + clicon_err(OE_CFG, EINVAL, "%s", cbuf_get(cb)); goto done; } }