Skip to content

Commit

Permalink
fix elastx cleanup security groups
Browse files Browse the repository at this point in the history
  • Loading branch information
yankay committed Sep 12, 2024
1 parent 4e6ae04 commit 8db2055
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions scripts/openstack-cleanup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ def main():
map_if_old(conn.compute.delete_server,
conn.compute.servers())

print('Security groups...')
try:
map_if_old(conn.network.delete_security_group,
conn.network.security_groups())
except openstack.exceptions.ConflictException as ex:
# Need to delete port when security groups is in used
map_if_old(conn.network.delete_port,
conn.network.ports())
map_if_old(conn.network.delete_security_group,
conn.network.security_groups())

print('Ports...')
try:
map_if_old(conn.network.delete_port,
Expand All @@ -73,6 +62,17 @@ def main():
map_if_old(conn.network.delete_port,
conn.network.ports())

print('Security groups...')
try:
map_if_old(conn.network.delete_security_group,
conn.network.security_groups())
except openstack.exceptions.ConflictException as ex:
# Need to delete port when security groups is in used
map_if_old(conn.network.delete_port,
conn.network.ports())
map_if_old(conn.network.delete_security_group,
conn.network.security_groups())

print('Subnets...')
map_if_old(conn.network.delete_subnet,
conn.network.subnets())
Expand Down Expand Up @@ -102,4 +102,4 @@ def fn_if_old(fn, item):

if __name__ == '__main__':
# execute only if run as a script
main()
main()

0 comments on commit 8db2055

Please sign in to comment.