Skip to content

Commit 866f2b8

Browse files
committed
Update 11518
1 parent 0073386 commit 866f2b8

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

systemvm/debian/opt/cloud/bin/checkrouter.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,21 @@
1818

1919
STATUS=UNKNOWN
2020

21-
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
22-
if [ "$ROUTER_TYPE" = "vpcrouter" ];then
23-
GUEST_NICS=$(python3 -c "
21+
get_guest_nics() {
22+
python3 -c "
2423
import json
2524
data = json.load(open('/etc/cloudstack/ips.json'))
2625
for nic, objs in data.items():
27-
if isinstance(objs, list):
28-
for obj in objs:
29-
if obj.get('nw_type') == 'guest' and obj.get('add'):
30-
print(nic)
31-
")
26+
if isinstance(objs, list):
27+
for obj in objs:
28+
if obj.get('nw_type') == 'guest' and obj.get('add'):
29+
print(nic)
30+
"
31+
}
32+
33+
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
34+
if [ "$ROUTER_TYPE" = "vpcrouter" ];then
35+
GUEST_NICS=$(get_guest_nics)
3236
if [ "$GUEST_NICS" = "" ];then
3337
echo "Status: ${STATUS}"
3438
exit

0 commit comments

Comments
 (0)