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@
|
||||
HOST_VENDOR = @host_vendor@
|
||||
|
||||
wwwdir = @wwwdir@
|
||||
|
||||
# one of fcgi or native:
|
||||
with_restconf = @with_restconf@
|
||||
|
||||
|
|
@ -151,6 +153,9 @@ distclean: clean
|
|||
install: install-lib $(APPL)
|
||||
install -d -m 0755 $(DESTDIR)$(sbindir)
|
||||
install -m 0755 $(INSTALLFLAGS) $(APPL) $(DESTDIR)$(sbindir)
|
||||
ifeq ($(with_restconf),fcgi)
|
||||
install -d -m 0755 $(DESTDIR)$(wwwdir)
|
||||
endif
|
||||
|
||||
install-lib: $(MYLIB)
|
||||
install -d -m 0755 $(DESTDIR)$(libdir)
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ clicon_msg_rcv(int s,
|
|||
goto done;
|
||||
}
|
||||
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");
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ startupdb=$dir/startup_db
|
|||
RESTCONFDBG=$DBG
|
||||
RCPROTO=http # no ssl here
|
||||
|
||||
RESTCONFDIR=$(dirname $(which clixon_restconf))
|
||||
|
||||
# log-destination in restconf xml: syslog or file
|
||||
: ${LOGDST:=syslog}
|
||||
# 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_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
||||
<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_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||
<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"
|
||||
fi
|
||||
|
||||
new "kill restconf"
|
||||
new "kill restconf using kill"
|
||||
stop_restconf_pre
|
||||
|
||||
new "Wait for restconf to stop"
|
||||
wait_restconf_stopped
|
||||
|
||||
new "8. start restconf RPC"
|
||||
rpcoperation start
|
||||
if [ $? -ne 0 ]; then exit -1; fi
|
||||
|
|
|
|||
|
|
@ -33,11 +33,21 @@ startupdb=$dir/startup_db
|
|||
# Restconf debug
|
||||
RESTCONFDBG=$DBG
|
||||
RCPROTO=http # no ssl here
|
||||
|
||||
RESTCONFDIR=$(dirname $(which clixon_restconf))
|
||||
|
||||
INVALIDADDR=251.1.1.1 # used by fourth usecase as invalid
|
||||
|
||||
# log-destination in restconf xml: syslog or file
|
||||
LOGDST=syslog
|
||||
LOGDST_CMD="s"
|
||||
: ${LOGDST:=syslog}
|
||||
# Set daemon command-line to -f
|
||||
if [ "$LOGDST" = syslog ]; then
|
||||
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
|
||||
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_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
||||
<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_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||
|
|
@ -182,10 +193,14 @@ echo "pid1:$pid1" # XXX
|
|||
ps aux|grep clixon_ # XXX
|
||||
|
||||
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"
|
||||
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
|
||||
|
||||
echo "pid1:$pid1" # XXX
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ fi
|
|||
|
||||
# Fcgi restconf requires /www-data directory for fcgi socket
|
||||
if [ ${with_restconf} = fcgi ]; then
|
||||
sudo mkdir /www-data
|
||||
if [ ! -d /www-data ]; then
|
||||
sudo mkdir /www-data
|
||||
fi
|
||||
sudo chown $wwwuser /www-data
|
||||
sudo chgrp $wwwuser /www-data
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -35,6 +35,13 @@ linuxrelease()
|
|||
break
|
||||
fi
|
||||
done
|
||||
# Special cases
|
||||
if [ "$release" = "unknown" ]; then
|
||||
if [ -n "$(echo "$box" | grep -io "bionic")" ]; then
|
||||
release=ubuntu
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
echo "$release"
|
||||
}
|
||||
|
||||
|
|
@ -53,6 +60,11 @@ wwwuser=www-data
|
|||
release=$(linuxrelease $box)
|
||||
echo "release:$release"
|
||||
|
||||
if [ "$release" = unknown ]; then
|
||||
echo "$box not recognized"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
test -d $dir || mkdir -p $dir
|
||||
|
||||
# Write a vagrant file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue