Merge pull request #1296 from remibergsma/fix-checkrouter-script47 CLOUDSTACK-9181 Prevent syntax error in checkrouter.shAdded quotes to prevent syntax errors in weird situations.
Error seen in mgt server: ``` 2015-12-15 14:30:32,371 DEBUG [c.c.a.m.AgentManagerImpl] (RedundantRouterStatusMonitor-7:ctx-0dd8ef3e) Details from executing class com.cloud.agent.api.CheckRouterCommand: Status: UNKNOWN /opt/cloud/bin/checkrouter.sh: line 28: [: =: unary operator expected /opt/cloud/bin/checkrouter.sh: line 31: [: =: unary operator expected ``` Cause: ``` root@r-1191-VM:/opt/cloud/bin# ./checkrouter.sh ./checkrouter.sh: line 28: [: =: unary operator expected ./checkrouter.sh: line 31: [: =: unary operator expected Status: UNKNOWN ``` Somehow a nic was missing. After fix the script can handle this: ``` root@r-1191-VM:/opt/cloud/bin# ./checkrouter.sh Status: UNKNOWN ``` The other states are also reported fine: ``` root@r-1191-VM:/opt/cloud/bin# ./checkrouter.sh Status: MASTER ``` ``` root@r-1192-VM:/opt/cloud/bin# ./checkrouter.sh Status: BACKUP ``` While at it, I also removed the INTERFACES variable/constant as it was only used once and hardcoded the second time. Now both are hardcoded and easier to read. * pr/1296: make both check lines consistent CLOUDSTACK-9181 Prevent syntax error in checkrouter.sh Signed-off-by: Remi Bergsma <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/66a933af Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/66a933af Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/66a933af Branch: refs/heads/master Commit: 66a933afab036da48a287cd5f8f1afab53cbd6be Parents: b4ebfb6 8fb6770 Author: Remi Bergsma <[email protected]> Authored: Sat Jan 16 19:46:06 2016 +0100 Committer: Remi Bergsma <[email protected]> Committed: Sat Jan 16 19:46:06 2016 +0100 ---------------------------------------------------------------------- .../patches/debian/config/opt/cloud/bin/checkrouter.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) ----------------------------------------------------------------------
