CLOUDSTACK-9181 Prevent syntax error in checkrouter.sh

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/525949e0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/525949e0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/525949e0

Branch: refs/heads/master
Commit: 525949e027d89a5c8ef0d1b7012446bb652be659
Parents: 9be76b3
Author: Remi Bergsma <[email protected]>
Authored: Wed Dec 16 11:27:26 2015 +0100
Committer: Remi Bergsma <[email protected]>
Committed: Mon Dec 28 17:06:43 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/525949e0/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh 
b/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh
index 0ba0ee5..f867a48 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh
+++ b/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh
@@ -19,19 +19,19 @@
 STATUS=UNKNOWN
 INTERFACE=eth1
 ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' 
| sed -e 's/[,\"]//g')
-if [ $ROUTER_TYPE = "router" ]
+if [ "$ROUTER_TYPE" = "router" ]
 then
        ROUTER_STATE=$(ip addr | grep eth0 | grep inet | wc -l | xargs bash -c  
'if [ $0 == 2 ]; then echo "MASTER"; else echo "BACKUP"; fi')
        STATUS=$ROUTER_STATE
 else
        ROUTER_STATE=$(ip addr | grep $INTERFACE | grep state | awk '{print 
$9;}')
-       if [ $ROUTER_STATE = "UP" ]
+       if [ "$ROUTER_STATE" = "UP" ]
        then
            STATUS=MASTER
-       elif [ $ROUTER_STATE = "DOWN" ]
+       elif [ "$ROUTER_STATE" = "DOWN" ]
        then
            STATUS=BACKUP
        fi
 fi
 
-echo "Status: ${STATUS}"
\ No newline at end of file
+echo "Status: ${STATUS}"

Reply via email to