summaryrefslogtreecommitdiffstats
path: root/lava-master/scripts
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-11-27 07:43:50 -0800
committerGitHub <noreply@github.com>2018-11-27 07:43:50 -0800
commit5227dbc047a9c2783f0c220794953afe7644f069 (patch)
tree016d2f674181016dd15755ca0b551505e0f5d1aa /lava-master/scripts
parent52d2feb37ec3e11c99e28540c7b7a14fd0de6747 (diff)
parente489f60b449b398cbe77316813e064a988158ff4 (diff)
Merge pull request #72 from montjoie/fix_backup_group
lava-master: skip creation of already existing groups
Diffstat (limited to 'lava-master/scripts')
-rwxr-xr-xlava-master/scripts/setup.sh20
1 files changed, 15 insertions, 5 deletions
diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh
index b362d16..e662a2b 100755
--- a/lava-master/scripts/setup.sh
+++ b/lava-master/scripts/setup.sh
@@ -67,18 +67,28 @@ if [ -e /root/lava-users ];then
fi
if [ -e /root/lava-groups ];then
+ echo "======================================================"
+ echo "Handle groups"
+ echo "======================================================"
+ GROUP_CURRENT_LIST=/tmp/group.list
+ lava-server manage groups list |grep '^\*' > $GROUP_CURRENT_LIST || exit 1
for group in $(ls /root/lava-groups/*group)
do
GROUPNAME=""
SUBMIT=0
OPTION_SUBMIT=""
. $group
- if [ $SUBMIT -eq 1 ];then
- echo "DEBUG: $GROUPNAME can submit jobs"
- OPTION_SUBMIT="--submitting"
+ grep -q $GROUPNAME $GROUP_CURRENT_LIST
+ if [ $? -eq 0 ];then
+ echo "DEBUG: SKIP creation of $GROUPNAME which already exists"
+ else
+ if [ $SUBMIT -eq 1 ];then
+ echo "DEBUG: $GROUPNAME can submit jobs"
+ OPTION_SUBMIT="--submitting"
+ fi
+ echo "DEBUG: Add group $GROUPNAME"
+ lava-server manage groups add $OPTION_SUBMIT $GROUPNAME || exit 1
fi
- echo "DEBUG: Add group $GROUPNAME"
- lava-server manage groups add $OPTION_SUBMIT $GROUPNAME || exit 1
if [ -e ${group}.list ];then
echo "DEBUG: Found ${group}.list"
while read username