aboutsummaryrefslogtreecommitdiff
path: root/ec2/spark_ec2.py
diff options
context:
space:
mode:
authorVladimir Grigor <vladimir@kiosked.com>2015-02-12 23:26:24 +0000
committerSean Owen <sowen@cloudera.com>2015-02-12 23:26:24 +0000
commitada993e954e2825c0fe13326fc23b0e1a567cd55 (patch)
treedee353d2f7cebc05f37b06c42f2ac74e6b129f2f /ec2/spark_ec2.py
parentd5fc51491808630d0328a5937dbf349e00de361f (diff)
downloadspark-ada993e954e2825c0fe13326fc23b0e1a567cd55.tar.gz
spark-ada993e954e2825c0fe13326fc23b0e1a567cd55.tar.bz2
spark-ada993e954e2825c0fe13326fc23b0e1a567cd55.zip
[SPARK-5335] Fix deletion of security groups within a VPC
Please see https://issues.apache.org/jira/browse/SPARK-5335. The fix itself is in e58a8b01a8bedcbfbbc6d04b1c1489255865cf87 commit. Two earlier commits are fixes of another VPC related bug waiting to be merged. I should have created former bug fix in own branch then this fix would not have former fixes. :( This code is released under the project's license. Author: Vladimir Grigor <vladimir@kiosked.com> Author: Vladimir Grigor <vladimir@voukka.com> Closes #4122 from voukka/SPARK-5335_delete_sg_vpc and squashes the following commits: 090dca9 [Vladimir Grigor] fixes as per review: removed printing of group_id and added comment 730ec05 [Vladimir Grigor] fix for SPARK-5335: Destroying cluster in VPC with "--delete-groups" fails to remove security groups
Diffstat (limited to 'ec2/spark_ec2.py')
-rwxr-xr-xec2/spark_ec2.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index 35209aec5f..c59ab565c6 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -1174,11 +1174,12 @@ def real_main():
time.sleep(30) # Yes, it does have to be this long :-(
for group in groups:
try:
- conn.delete_security_group(group.name)
- print "Deleted security group " + group.name
+ # It is needed to use group_id to make it work with VPC
+ conn.delete_security_group(group_id=group.id)
+ print "Deleted security group %s" % group.name
except boto.exception.EC2ResponseError:
success = False
- print "Failed to delete security group " + group.name
+ print "Failed to delete security group %s" % group.name
# Unfortunately, group.revoke() returns True even if a rule was not
# deleted, so this needs to be rerun if something fails