diff options
author | Kevin Hilman <khilman@baylibre.com> | 2021-01-04 08:36:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 08:36:41 -0800 |
commit | 9b1f44982e0091d5e620d225b59ad5a4c0fc5aeb (patch) | |
tree | 075621a294fd16b0e177529af3073427aedd3c64 /lava-slave/scripts/setup.sh | |
parent | 7151f9ebc95495b0eb3beb6ee556737a5c6ed163 (diff) | |
parent | 7739038c60331b71add3d5183412e50a38bfa2f3 (diff) |
Merge pull request #130 from montjoie/support-2020.09plus
Support 2020.09plus
Diffstat (limited to 'lava-slave/scripts/setup.sh')
-rwxr-xr-x | lava-slave/scripts/setup.sh | 18 |
1 files changed, 18 insertions, 0 deletions
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" |