Browse code

Normalise RECLONE flag to True Or False.

RECLONE flag now uses function trueorfalse for flag handling.
Added more flag cases to normalisation function trueorfalse.

Fixes bug #1200382

Change-Id: I0738537c87634281c6a92fa93b7f84a6b0dad497

Sirushti Murugesan authored on 2013/09/25 15:00:31
Showing 1 changed files
... ...
@@ -551,6 +551,7 @@ function git_clone {
551 551
     GIT_REMOTE=$1
552 552
     GIT_DEST=$2
553 553
     GIT_REF=$3
554
+    RECLONE=$(trueorfalse False $RECLONE)
554 555
 
555 556
     if [[ "$OFFLINE" = "True" ]]; then
556 557
         echo "Running in offline mode, clones already exist"
... ...
@@ -576,7 +577,7 @@ function git_clone {
576 576
             cd $GIT_DEST
577 577
             # This checkout syntax works for both branches and tags
578 578
             git checkout $GIT_REF
579
-        elif [[ "$RECLONE" == "yes" ]]; then
579
+        elif [[ "$RECLONE" = "True" ]]; then
580 580
             # if it does exist then simulate what clone does if asked to RECLONE
581 581
             cd $GIT_DEST
582 582
             # set the url to pull from and fetch
... ...
@@ -1260,16 +1261,16 @@ function stop_service() {
1260 1260
 
1261 1261
 
1262 1262
 # Normalize config values to True or False
1263
-# Accepts as False: 0 no false False FALSE
1264
-# Accepts as True: 1 yes true True TRUE
1263
+# Accepts as False: 0 no No NO false False FALSE
1264
+# Accepts as True: 1 yes Yes YES true True TRUE
1265 1265
 # VAR=$(trueorfalse default-value test-value)
1266 1266
 function trueorfalse() {
1267 1267
     local default=$1
1268 1268
     local testval=$2
1269 1269
 
1270 1270
     [[ -z "$testval" ]] && { echo "$default"; return; }
1271
-    [[ "0 no false False FALSE" =~ "$testval" ]] && { echo "False"; return; }
1272
-    [[ "1 yes true True TRUE" =~ "$testval" ]] && { echo "True"; return; }
1271
+    [[ "0 no No NO false False FALSE" =~ "$testval" ]] && { echo "False"; return; }
1272
+    [[ "1 yes Yes YES true True TRUE" =~ "$testval" ]] && { echo "True"; return; }
1273 1273
     echo "$default"
1274 1274
 }
1275 1275