Skip to content

Commit 05269ad

Browse files
committed
check treehouses config has security group and key name
1 parent 747d45e commit 05269ad

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/aws/down.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,31 @@ storePortAndDeleteSecurityGroupWithSleepAndRetry() {
8181
done
8282
}
8383

84+
treehousesConfigHas() {
85+
local keyName=$1
86+
local groupName=$2
87+
88+
if [ "$keyName" == "null" ] || [ "$groupName" == "null" ]; then
89+
return 1
90+
fi
91+
92+
return 0
93+
}
94+
8495
function down() {
8596

8697
balloonName=$(setBalloonName "$1")
8798
keyName=$(getValueByAttribute "$balloonName" key)
8899
groupName=$(getValueByAttribute "$balloonName" groupName)
89100

101+
treehousesConfigHas "$keyName" "$groupName"
102+
checkResult=$?
103+
104+
if [ $checkResult -eq 1 ]; then
105+
echo "Treehouses config is corrupted, manual cleanup required"
106+
exit 1
107+
fi
108+
90109
detectIncompleteState "$balloonName" "$groupName" "$keyName"
91110
binaryState=$?
92111

0 commit comments

Comments
 (0)