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)
|
||||
goto done;
|
||||
/* Only accept resolved NETCONF base namespace */
|
||||
if (namespace == NULL || strcmp(namespace, NETCONF_BASE_NAMESPACE) != 0){
|
||||
if (netconf_unknown_namespace(cbret, "protocol", rpcprefix, "No appropriate namespace associated with prefix") < 0)
|
||||
if (namespace == NULL){
|
||||
if (netconf_bad_element(cbret, "protocol", rpcname, "No namespace associated with prefix") < 0)
|
||||
goto done;
|
||||
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){
|
||||
; /* continue below */
|
||||
|
|
|
|||
32
test/lib.sh
32
test/lib.sh
|
|
@ -49,23 +49,23 @@ if [ -f ./site.sh ]; then
|
|||
done
|
||||
fi
|
||||
|
||||
# Auto-start nginx
|
||||
if false; then # Does not work on some platforms
|
||||
nginxactive=$(systemctl show nginx |grep ActiveState=active)
|
||||
if [ "${WITH_RESTCONF}" = "fcgi" ]; 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[0m"
|
||||
exit -1
|
||||
# Sanity nginx running on systemd platforms
|
||||
if systemctl > /dev/null; then
|
||||
nginxactive=$(systemctl show nginx |grep ActiveState=active)
|
||||
if [ "${WITH_RESTCONF}" = "fcgi" ]; 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[0m"
|
||||
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
|
||||
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
|
||||
fi # systemctl
|
||||
# Test number from start
|
||||
: ${testnr:=0}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue