test systemctl; better rpc namespace errormsg
This commit is contained in:
parent
5088f23e6a
commit
4ecffa6885
2 changed files with 30 additions and 18 deletions
|
|
@ -1643,11 +1643,23 @@ from_client_msg(clicon_handle h,
|
||||||
if (xml2ns(x, rpcprefix, &namespace) < 0)
|
if (xml2ns(x, rpcprefix, &namespace) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
/* Only accept resolved NETCONF base namespace */
|
/* Only accept resolved NETCONF base namespace */
|
||||||
if (namespace == NULL || strcmp(namespace, NETCONF_BASE_NAMESPACE) != 0){
|
if (namespace == NULL){
|
||||||
if (netconf_unknown_namespace(cbret, "protocol", rpcprefix, "No appropriate namespace associated with prefix") < 0)
|
if (netconf_bad_element(cbret, "protocol", rpcname, "No namespace associated with prefix") < 0)
|
||||||
goto done;
|
goto done;
|
||||||
goto reply;
|
goto reply;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(namespace, NETCONF_BASE_NAMESPACE) != 0){
|
||||||
|
cbuf *cbmsg;
|
||||||
|
if ((cbmsg = cbuf_new()) == NULL){
|
||||||
|
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
cprintf(cbmsg, "No appropriate namespace found for: %s %s", rpcprefix, rpcname);
|
||||||
|
if (netconf_unknown_namespace(cbret, "protocol", namespace, cbuf_get(cbmsg)) < 0)
|
||||||
|
goto done;
|
||||||
|
cbuf_free(cbmsg);
|
||||||
|
goto reply;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(rpcname, "rpc") == 0){
|
if (strcmp(rpcname, "rpc") == 0){
|
||||||
; /* continue below */
|
; /* continue below */
|
||||||
|
|
|
||||||
32
test/lib.sh
32
test/lib.sh
|
|
@ -49,23 +49,23 @@ if [ -f ./site.sh ]; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Auto-start nginx
|
# Sanity nginx running on systemd platforms
|
||||||
if false; then # Does not work on some platforms
|
if systemctl > /dev/null; then
|
||||||
nginxactive=$(systemctl show nginx |grep ActiveState=active)
|
nginxactive=$(systemctl show nginx |grep ActiveState=active)
|
||||||
if [ "${WITH_RESTCONF}" = "fcgi" ]; then
|
if [ "${WITH_RESTCONF}" = "fcgi" ]; then
|
||||||
if [ -z "$nginxactive" ]; then
|
if [ -z "$nginxactive" ]; then
|
||||||
echo -e "\e[31m\nwith-restconf=fcgi set but nginx not running, start with systemctl start nginx"
|
echo -e "\e[31m\nwith-restconf=fcgi set but nginx not running, start with systemctl start nginx"
|
||||||
echo -e "\e[0m"
|
echo -e "\e[0m"
|
||||||
exit -1
|
exit -1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -n "$nginxactive" ]; then
|
||||||
|
echo -e "\e[31m\nwith-restconf=fcgi not set but nginx running, stop with systemctl stop nginx"
|
||||||
|
echo -e "\e[0m"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
fi # systemctl
|
||||||
if [ -n "$nginxactive" ]; then
|
|
||||||
echo -e "\e[31m\nwith-restconf=fcgi not set but nginx running, stop with systemctl stop nginx"
|
|
||||||
echo -e "\e[0m"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# Test number from start
|
# Test number from start
|
||||||
: ${testnr:=0}
|
: ${testnr:=0}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue