Add proper error message if namespace not found in module-set header

This commit is contained in:
Olof hagsand 2022-11-28 13:50:41 +01:00
parent 7a388b960a
commit 8ebab16c4c
4 changed files with 9 additions and 4 deletions

View file

@ -221,9 +221,12 @@ startup_common(clicon_handle h,
if (msdiff){ if (msdiff){
if ((ret = clixon_module_upgrade(h, xt, msdiff, cbret)) < 0) if ((ret = clixon_module_upgrade(h, xt, msdiff, cbret)) < 0)
goto done; goto done;
if (ret == 0) if (ret == 0){
if (cbuf_len(cbret) == 0)
cprintf(cbret, "Module-set upgrade function returned failure but lacks reason (cbret is not set)");
goto fail; goto fail;
} }
}
/* Print upgraded db: -q backend switch for debugging/ showing upgraded config only */ /* Print upgraded db: -q backend switch for debugging/ showing upgraded config only */
if (clicon_quit_upgrade_get(h) == 1){ if (clicon_quit_upgrade_get(h) == 1){
/* bind yang */ /* bind yang */

View file

@ -424,8 +424,10 @@ mod_ns_upgrade(clicon_handle h,
/* If modified or added get to revision from system */ /* If modified or added get to revision from system */
if (xml_flag(xmod, (XML_FLAG_CHANGE|XML_FLAG_ADD)) != 0x0){ if (xml_flag(xmod, (XML_FLAG_CHANGE|XML_FLAG_ADD)) != 0x0){
yspec = clicon_dbspec_yang(h); yspec = clicon_dbspec_yang(h);
if ((ymod = yang_find_module_by_namespace(yspec, ns)) == NULL) if ((ymod = yang_find_module_by_namespace(yspec, ns)) == NULL){
cprintf(cbret, "Module-set upgrade header contains namespace %s, but is not found in running system", ns);
goto fail; goto fail;
}
if ((yrev = yang_find(ymod, Y_REVISION, NULL)) == NULL){ if ((yrev = yang_find(ymod, Y_REVISION, NULL)) == NULL){
retval = 1; retval = 1;
goto done; goto done;

View file

@ -427,7 +427,8 @@ function err(){
ret=$2 ret=$2
echo -e "\e[31m\nError in Test$testnr [$testname]:" echo -e "\e[31m\nError in Test$testnr [$testname]:"
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
echo "Expected: $1" echo "Expected"
echo "$1"
echo echo
fi fi
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View file

@ -195,7 +195,6 @@ EOF
if ! $enable; then if ! $enable; then
# XXX or bad request? # XXX or bad request?
new "WWW get html, not enabled, expect not found" new "WWW get html, not enabled, expect not found"
# echo "curl $CURLOPTS -X GET -H 'Accept: text/html' $proto://localhost/data/index.html"
expectpart "$(curl $CURLOPTS -X GET -H 'Accept: text/html' $proto://localhost/data/index.html)" 0 "HTTP/$HVER 404" expectpart "$(curl $CURLOPTS -X GET -H 'Accept: text/html' $proto://localhost/data/index.html)" 0 "HTTP/$HVER 404"
else else
new "WWW get root expect 404 without body" new "WWW get root expect 404 without body"