diff options
Diffstat (limited to 'lava-slave')
-rw-r--r-- | lava-slave/Dockerfile | 5 | ||||
-rw-r--r-- | lava-slave/lava-screen.conf | 0 | ||||
-rw-r--r-- | lava-slave/scripts/getworkertoken.py | 15 | ||||
-rwxr-xr-x | lava-slave/scripts/setup.sh | 18 | ||||
-rwxr-xr-x | lava-slave/scripts/start.sh | 13 |
5 files changed, 33 insertions, 18 deletions
diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index b37f7a6..bb59174 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -68,11 +68,6 @@ RUN chmod +x /root/entrypoint.d/* RUN if [ -x /usr/local/bin/extra_actions ] ; then /usr/local/bin/extra_actions ; fi -RUN apt-get -y install screen openssh-server -RUN ssh-keygen -q -f /root/.ssh/id_rsa -RUN cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys -COPY lava-screen.conf /root/ - COPY zmq_auth/ /etc/lava-dispatcher/certificates.d/ EXPOSE 69/udp 80 diff --git a/lava-slave/lava-screen.conf b/lava-slave/lava-screen.conf deleted file mode 100644 index e69de29..0000000 --- a/lava-slave/lava-screen.conf +++ /dev/null diff --git a/lava-slave/scripts/getworkertoken.py b/lava-slave/scripts/getworkertoken.py new file mode 100644 index 0000000..f538960 --- /dev/null +++ b/lava-slave/scripts/getworkertoken.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import xmlrpc.client +import sys + +if len(sys.argv) < 3: + print("ERROR: Usage: %s URI workername" % sys.argv[0]) + sys.exit(1) + +server = xmlrpc.client.ServerProxy("%s" % sys.argv[1]) +wdet = server.scheduler.workers.show("%s" % sys.argv[2]) +if "token" in wdet: + print(wdet["token"]) + sys.exit(0) +sys.exit(1) diff --git a/lava-slave/scripts/setup.sh b/lava-slave/scripts/setup.sh index 58672c3..9873a91 100755 --- a/lava-slave/scripts/setup.sh +++ b/lava-slave/scripts/setup.sh @@ -68,6 +68,24 @@ do else echo "Adding worker $worker" lavacli $LAVACLIOPTS workers add --description "LAVA dispatcher on $(cat /root/phyhostname)" $worker || exit $? + # does we ran 2020.09+ and worker need a token + fi + grep -q "TOKEN" /root/entrypoint.sh + if [ $? -eq 0 ];then + echo "DEBUG: Worker need a TOKEN" + # TODO use token from env + WTOKEN=$(getworkertoken.py $LAVA_MASTER_URI $worker) + if [ $? -eq 0 ];then + sed -i "s,.*TOKEN.*,TOKEN=\"--token $WTOKEN\"," /etc/lava-dispatcher/lava-worker || exit $? + else + echo "ERROR: cannot get WORKER TOKEN" + exit 1 + fi + echo "DEBUG: set master URL to $LAVA_MASTER_URL" + sed -i "s,^# URL.*,URL=\"$LAVA_MASTER_URL\"," /etc/lava-dispatcher/lava-worker || exit $? + cat /etc/lava-dispatcher/lava-worker + else + echo "DEBUG: Worker does not need a TOKEN" fi if [ ! -z "$LAVA_DISPATCHER_IP" ];then echo "Add dispatcher_ip $LAVA_DISPATCHER_IP to $worker" diff --git a/lava-slave/scripts/start.sh b/lava-slave/scripts/start.sh index 334f52e..8d7882f 100755 --- a/lava-slave/scripts/start.sh +++ b/lava-slave/scripts/start.sh @@ -25,19 +25,6 @@ do /usr/sbin/conmux $item & done -HAVE_SCREEN=0 -while read screenboard -do - echo "Start screen for $screenboard" - TERM=xterm screen -d -m -S $screenboard /dev/$screenboard 115200 -ixoff -ixon || exit 9 - HAVE_SCREEN=1 -done < /root/lava-screen.conf -if [ $HAVE_SCREEN -eq 1 ];then - sed -i 's,UsePAM.*yes,UsePAM no,' /etc/ssh/sshd_config || exit 10 - service ssh start || exit 11 -fi - - # start an http file server for boot/transfer_overlay support (cd /var/lib/lava/dispatcher; python3 -m http.server 80) & |