GitHub user remibergsma opened a pull request:

    https://github.com/apache/cloudstack/pull/1295

    CLOUDSTACK-9181 Prevent syntax error in checkrouter.sh

    Added 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.
    
    This is the same as PR #1249 except it is against `4.7`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/remibergsma/cloudstack 
fix-checkrouter-script47

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/1295.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1295
    
----
commit 525949e027d89a5c8ef0d1b7012446bb652be659
Author: Remi Bergsma <git...@remi.nl>
Date:   2015-12-16T10:27:26Z

    CLOUDSTACK-9181 Prevent syntax error in checkrouter.sh

commit 8fb677027dc48d034fa9440b125c6bae084266d4
Author: Remi Bergsma <git...@remi.nl>
Date:   2015-12-16T13:45:57Z

    make both check lines consistent
    
    No need to make a variable, use it on one place and hardcode it on another.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to