Skip to content
Snippets Groups Projects
Commit 6d22f7cc authored by Peter Sankauskas's avatar Peter Sankauskas
Browse files

Delete security groups when deleting the cluster. As many operations

are done on instances in specific security groups, this seems like a
reasonable thing to clean up.
parent c23a74df
No related branches found
No related tags found
No related merge requests found
......@@ -509,6 +509,20 @@ def main():
print "Terminating zoo..."
for inst in zoo_nodes:
inst.terminate()
# Delete security groups as well
group_names = [cluster_name + "-master", cluster_name + "-slaves", cluster_name + "-zoo"]
groups = conn.get_all_security_groups()
for group in groups:
if group.name in group_names:
print "Deleting security group " + group.name
# Delete individual rules before deleting group to remove dependencies
for rule in group.rules:
for grant in rule.grants:
group.revoke(ip_protocol=rule.ip_protocol,
from_port=rule.from_port,
to_port=rule.to_port,
src_group=grant)
conn.delete_security_group(group.name)
elif action == "login":
(master_nodes, slave_nodes, zoo_nodes) = get_existing_cluster(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment