summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-07-17 13:30:43 +0200
committerCorentin LABBE <clabbe@baylibre.com>2018-07-20 11:41:58 +0200
commit0f09e5c9b89cee21a6ee39db9daf8e17525dd493 (patch)
tree74df58a2fbfa092916149b0a1610535b171a2fb6
parentd49b99094855c8bcb91fd5ab57b20249ff7ff955 (diff)
Do not add already existing token
When restoring a database, token are restored and so cannot be re-created.
-rwxr-xr-xlava-master/scripts/setup.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh
index ad10238..6ab0663 100755
--- a/lava-master/scripts/setup.sh
+++ b/lava-master/scripts/setup.sh
@@ -70,8 +70,13 @@ if [ -e /root/lava-callback-tokens ];then
echo "Missing DESCRIPTION for $USER"
exit 1
fi
- echo "Adding $USER ($DESCRIPTION) DEBUG($TOKEN)"
- lava-server manage tokens add --user $USER --secret $TOKEN --description "$DESCRIPTION" || exit 1
+ lava-server manage tokens list --user $USER |grep -q $TOKEN
+ if [ $? -eq 0 ];then
+ echo "SKIP already present token for $USER"
+ else
+ echo "Adding $USER ($DESCRIPTION) DEBUG($TOKEN)"
+ lava-server manage tokens add --user $USER --secret $TOKEN --description "$DESCRIPTION" || exit 1
+ fi
done
fi