Several fixes to restconf internal and vagrants tests
This commit is contained in:
parent
603f70e51f
commit
ae02d02d63
6 changed files with 47 additions and 7 deletions
|
|
@ -57,6 +57,8 @@ sysconfdir = @sysconfdir@
|
||||||
includedir = @includedir@
|
includedir = @includedir@
|
||||||
HOST_VENDOR = @host_vendor@
|
HOST_VENDOR = @host_vendor@
|
||||||
|
|
||||||
|
wwwdir = @wwwdir@
|
||||||
|
|
||||||
# one of fcgi or native:
|
# one of fcgi or native:
|
||||||
with_restconf = @with_restconf@
|
with_restconf = @with_restconf@
|
||||||
|
|
||||||
|
|
@ -151,6 +153,9 @@ distclean: clean
|
||||||
install: install-lib $(APPL)
|
install: install-lib $(APPL)
|
||||||
install -d -m 0755 $(DESTDIR)$(sbindir)
|
install -d -m 0755 $(DESTDIR)$(sbindir)
|
||||||
install -m 0755 $(INSTALLFLAGS) $(APPL) $(DESTDIR)$(sbindir)
|
install -m 0755 $(INSTALLFLAGS) $(APPL) $(DESTDIR)$(sbindir)
|
||||||
|
ifeq ($(with_restconf),fcgi)
|
||||||
|
install -d -m 0755 $(DESTDIR)$(wwwdir)
|
||||||
|
endif
|
||||||
|
|
||||||
install-lib: $(MYLIB)
|
install-lib: $(MYLIB)
|
||||||
install -d -m 0755 $(DESTDIR)$(libdir)
|
install -d -m 0755 $(DESTDIR)$(libdir)
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ clicon_msg_rcv(int s,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
memcpy(*msg, &hdr, hlen);
|
memcpy(*msg, &hdr, hlen);
|
||||||
if ((len2 = atomicio(read, s, (*msg)->op_body, mlen - sizeof(hdr))) == 0){
|
if ((len2 = atomicio(read, s, (*msg)->op_body, mlen - sizeof(hdr))) < 0){
|
||||||
clicon_err(OE_CFG, errno, "read");
|
clicon_err(OE_CFG, errno, "read");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ startupdb=$dir/startup_db
|
||||||
RESTCONFDBG=$DBG
|
RESTCONFDBG=$DBG
|
||||||
RCPROTO=http # no ssl here
|
RCPROTO=http # no ssl here
|
||||||
|
|
||||||
|
RESTCONFDIR=$(dirname $(which clixon_restconf))
|
||||||
|
|
||||||
# log-destination in restconf xml: syslog or file
|
# log-destination in restconf xml: syslog or file
|
||||||
: ${LOGDST:=syslog}
|
: ${LOGDST:=syslog}
|
||||||
# Set daemon command-line to -f
|
# Set daemon command-line to -f
|
||||||
|
|
@ -52,6 +54,7 @@ cat <<EOF > $cfg
|
||||||
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
||||||
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
||||||
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
|
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
|
||||||
|
<CLICON_RESTCONF_INSTALL_DIR>$RESTCONFDIR</CLICON_RESTCONF_INSTALL_DIR>
|
||||||
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
||||||
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||||
|
|
@ -272,9 +275,12 @@ if [ $pid0 -eq $pid3 ]; then
|
||||||
err1 "A different pid" "same pid: $pid3"
|
err1 "A different pid" "same pid: $pid3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "kill restconf"
|
new "kill restconf using kill"
|
||||||
stop_restconf_pre
|
stop_restconf_pre
|
||||||
|
|
||||||
|
new "Wait for restconf to stop"
|
||||||
|
wait_restconf_stopped
|
||||||
|
|
||||||
new "8. start restconf RPC"
|
new "8. start restconf RPC"
|
||||||
rpcoperation start
|
rpcoperation start
|
||||||
if [ $? -ne 0 ]; then exit -1; fi
|
if [ $? -ne 0 ]; then exit -1; fi
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,21 @@ startupdb=$dir/startup_db
|
||||||
# Restconf debug
|
# Restconf debug
|
||||||
RESTCONFDBG=$DBG
|
RESTCONFDBG=$DBG
|
||||||
RCPROTO=http # no ssl here
|
RCPROTO=http # no ssl here
|
||||||
|
|
||||||
|
RESTCONFDIR=$(dirname $(which clixon_restconf))
|
||||||
|
|
||||||
INVALIDADDR=251.1.1.1 # used by fourth usecase as invalid
|
INVALIDADDR=251.1.1.1 # used by fourth usecase as invalid
|
||||||
|
|
||||||
# log-destination in restconf xml: syslog or file
|
# log-destination in restconf xml: syslog or file
|
||||||
LOGDST=syslog
|
: ${LOGDST:=syslog}
|
||||||
|
# Set daemon command-line to -f
|
||||||
|
if [ "$LOGDST" = syslog ]; then
|
||||||
LOGDST_CMD="s"
|
LOGDST_CMD="s"
|
||||||
|
elif [ "$LOGDST" = file ]; then
|
||||||
|
LOGDST_CMD="f/var/log/clixon_restconf.log"
|
||||||
|
else
|
||||||
|
err1 "No such logdst: $LOGDST"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${WITH_RESTCONF}" = "fcgi" ]; then
|
if [ "${WITH_RESTCONF}" = "fcgi" ]; then
|
||||||
EXTRACONF="<CLICON_FEATURE>clixon-restconf:fcgi</CLICON_FEATURE>"
|
EXTRACONF="<CLICON_FEATURE>clixon-restconf:fcgi</CLICON_FEATURE>"
|
||||||
|
|
@ -58,6 +68,7 @@ cat <<EOF > $cfg
|
||||||
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
||||||
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
||||||
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
|
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
|
||||||
|
<CLICON_RESTCONF_INSTALL_DIR>$RESTCONFDIR</CLICON_RESTCONF_INSTALL_DIR>
|
||||||
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
||||||
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||||
|
|
@ -182,10 +193,14 @@ echo "pid1:$pid1" # XXX
|
||||||
ps aux|grep clixon_ # XXX
|
ps aux|grep clixon_ # XXX
|
||||||
|
|
||||||
new "Check $pid1 exists"
|
new "Check $pid1 exists"
|
||||||
while sudo kill -0 $pid1 2> /dev/null; do
|
# Here backend dies / is killed
|
||||||
|
#while sudo kill -0 $pid1 2> /dev/null; do
|
||||||
|
while sudo kill -0 $pid1; do # XXX
|
||||||
new "kill $pid1 externally"
|
new "kill $pid1 externally"
|
||||||
sudo kill $pid1
|
sudo kill $pid1
|
||||||
sleep $DEMSLEEP
|
sleep 1 # There is a race condition here when restconf is killed while waiting for reply from backend
|
||||||
|
echo "pid1:$pid1" # XXX
|
||||||
|
ps aux|grep clixon_ # XXX
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "pid1:$pid1" # XXX
|
echo "pid1:$pid1" # XXX
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,9 @@ fi
|
||||||
|
|
||||||
# Fcgi restconf requires /www-data directory for fcgi socket
|
# Fcgi restconf requires /www-data directory for fcgi socket
|
||||||
if [ ${with_restconf} = fcgi ]; then
|
if [ ${with_restconf} = fcgi ]; then
|
||||||
|
if [ ! -d /www-data ]; then
|
||||||
sudo mkdir /www-data
|
sudo mkdir /www-data
|
||||||
|
fi
|
||||||
sudo chown $wwwuser /www-data
|
sudo chown $wwwuser /www-data
|
||||||
sudo chgrp $wwwuser /www-data
|
sudo chgrp $wwwuser /www-data
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,13 @@ linuxrelease()
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
# Special cases
|
||||||
|
if [ "$release" = "unknown" ]; then
|
||||||
|
if [ -n "$(echo "$box" | grep -io "bionic")" ]; then
|
||||||
|
release=ubuntu
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
echo "$release"
|
echo "$release"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,6 +60,11 @@ wwwuser=www-data
|
||||||
release=$(linuxrelease $box)
|
release=$(linuxrelease $box)
|
||||||
echo "release:$release"
|
echo "release:$release"
|
||||||
|
|
||||||
|
if [ "$release" = unknown ]; then
|
||||||
|
echo "$box not recognized"
|
||||||
|
exit 255
|
||||||
|
fi
|
||||||
|
|
||||||
test -d $dir || mkdir -p $dir
|
test -d $dir || mkdir -p $dir
|
||||||
|
|
||||||
# Write a vagrant file
|
# Write a vagrant file
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue