Improved clispec parse error message

Improved datastore_multi mem test
This commit is contained in:
Olof hagsand 2025-01-28 22:36:19 +01:00
parent bf3451c8ed
commit fc3f0cbcd9
2 changed files with 16 additions and 6 deletions

View file

@ -1793,6 +1793,7 @@ yang2cli_yspec(clixon_handle h,
yang_stmt *ymod; yang_stmt *ymod;
int enable; int enable;
cbuf *cb = NULL; cbuf *cb = NULL;
cbuf *cbname = NULL;
char *prefix; char *prefix;
cg_obj *co; cg_obj *co;
int i; int i;
@ -1833,13 +1834,19 @@ yang2cli_yspec(clixon_handle h,
clixon_err(OE_UNIX, errno, "pt_new"); clixon_err(OE_UNIX, errno, "pt_new");
goto done; goto done;
} }
/* Make a proper clispec name for debugging */
if ((cbname = cbuf_new()) == NULL){
clixon_err(OE_XML, errno, "cbuf_new");
goto done;
}
cprintf(cbname, "Auto-cli for module: %s", yang_filename_get(ymod));
/* Parse the buffer using cligen parser. load cli syntax */ /* Parse the buffer using cligen parser. load cli syntax */
if (clispec_parse_str(cli_cligen(h), cbuf_get(cb), "yang2cli", NULL, pt, NULL) < 0){ if (clispec_parse_str(cli_cligen(h), cbuf_get(cb), cbuf_get(cbname), NULL, pt, NULL) < 0){
fprintf(stderr, "%s\n", cbuf_get(cb)); clixon_err(OE_YANG, errno, "Failing clispec: %s", cbuf_get(cb));
goto done; goto done;
} }
clixon_debug(CLIXON_DBG_CLI, "Generated auto-cli for module:%s", clixon_debug(CLIXON_DBG_CLI, "Generated auto-cli for module:%s",
yang_argument_get(ymod)); yang_filename_get(ymod));
/* Add prefix: assume new are appended */ /* Add prefix: assume new are appended */
for (i=0; i<pt_len_get(pt); i++){ for (i=0; i<pt_len_get(pt); i++){
if ((co = pt_vec_i_get(pt, i)) != NULL){ if ((co = pt_vec_i_get(pt, i)) != NULL){
@ -1896,6 +1903,8 @@ yang2cli_yspec(clixon_handle h,
pt_free(pt0, 1); pt_free(pt0, 1);
if (cb) if (cb)
cbuf_free(cb); cbuf_free(cb);
if (cbname)
cbuf_free(cbname);
return retval; return retval;
} }

View file

@ -361,10 +361,11 @@ if [ $BE -ne 0 ]; then
if [ -z "$pid" ]; then if [ -z "$pid" ]; then
err "backend already dead" err "backend already dead"
fi fi
# kill backend sudo clixon_backend -zf $cfg
stop_backend -f $cfg if [ $? -ne 0 ]; then
err
fi
fi fi
sudo rm -rf $dir sudo rm -rf $dir