From a9c41d2882d4b63f201e43fde959f375bdc3c2ad Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Mon, 23 Nov 2020 09:17:36 +0000 Subject: Handle 2020.09+ workers Since 2020.09, workers does not use ZMQ anymore but use a token. This patch permit our setup to detecte when we use LAVA 2020.09+ and retrieve it from master. --- lava-slave/scripts/setup.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lava-slave/scripts/setup.sh') 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" -- cgit 1.2.3-korg