diff options
author | khilman <khilman@users.noreply.github.com> | 2018-07-16 09:19:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-16 09:19:33 -0500 |
commit | ed83f7aa1af39e75c10d5e8c4f1385c302beec12 (patch) | |
tree | 62f7a84132c06b1c0f121c25908387854aae820b /lava-master/scripts/setup.sh | |
parent | c0ef82c6a0673990f2dfaa0bcf47287a5513eb27 (diff) | |
parent | 32221a4e8fe36fd5c3c972039932cb53a25b1d5c (diff) |
Merge pull request #30 from montjoie/fix072018
Fix072018
Diffstat (limited to 'lava-master/scripts/setup.sh')
-rwxr-xr-x | lava-master/scripts/setup.sh | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh index 3ab2abd..585499e 100755 --- a/lava-master/scripts/setup.sh +++ b/lava-master/scripts/setup.sh @@ -20,10 +20,15 @@ if [ -e /root/lava-users ];then if [ $SUPERUSER -eq 1 ];then USER_OPTION="$USER_OPTION --superuser" fi - echo "Adding username $USER DEBUG(with $TOKEN / $PASSWORD / $USER_OPTION)" - lava-server manage users add --passwd $PASSWORD $USER_OPTION $USER || exit 1 - if [ ! -z "$TOKEN" ];then - lava-server manage tokens add --user $USER --secret $TOKEN || exit 1 + lava-server manage users list | grep -q "[[:space:]]$USER$" + if [ $? -eq 0 ];then + echo "Skip already existing $USER DEBUG(with $TOKEN / $PASSWORD / $USER_OPTION)" + else + echo "Adding username $USER DEBUG(with $TOKEN / $PASSWORD / $USER_OPTION)" + lava-server manage users add --passwd $PASSWORD $USER_OPTION $USER || exit 1 + if [ ! -z "$TOKEN" ];then + lava-server manage tokens add --user $USER --secret $TOKEN || exit 1 + fi fi done fi @@ -56,9 +61,14 @@ if [ -e /root/device-types ];then do cp $i /etc/lava-server/dispatcher-config/device-types/ devicetype=$(basename $i |sed 's,.jinja2,,') - echo "Adding custom $devicetype" - lava-server manage device-types add $devicetype || exit $? - touch /root/.lavadocker/devicetype-$devicetype + lava-server manage device-types list | grep -q "[[:space:]]$devicetype[[:space:]]" + if [ $? -eq 0 ];then + echo "Skip already known $devicetype" + else + echo "Adding custom $devicetype" + lava-server manage device-types add $devicetype || exit $? + touch /root/.lavadocker/devicetype-$devicetype + fi done fi |