Skip to content

Commit

Permalink
fix openstack cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Kay Yan <[email protected]>
  • Loading branch information
yankay committed Jun 18, 2024
1 parent 3e72be2 commit 4cee9b0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/openstack-cleanup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ def main():
conn.compute.servers())

print('Security groups...')
map_if_old(conn.network.delete_security_group,
conn.network.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:
Expand Down

0 comments on commit 4cee9b0

Please sign in to comment.