[
https://issues.apache.org/jira/browse/CLOUDSTACK-9181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15072853#comment-15072853
]
ASF GitHub Bot commented on CLOUDSTACK-9181:
--------------------------------------------
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 <[email protected]>
Date: 2015-12-16T10:27:26Z
CLOUDSTACK-9181 Prevent syntax error in checkrouter.sh
commit 8fb677027dc48d034fa9440b125c6bae084266d4
Author: Remi Bergsma <[email protected]>
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.
----
> Syntax error in checkrouter.sh when interface is missing
> --------------------------------------------------------
>
> Key: CLOUDSTACK-9181
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9181
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Virtual Router
> Affects Versions: 4.7.0
> Reporter: Remi Bergsma
>
> 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
> 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
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)