From 4577ee4a5d0f73a99a776169bddcf5b68d240843 Mon Sep 17 00:00:00 2001 From: k8s-infra-cherrypick-robot <90416843+k8s-infra-cherrypick-robot@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:43:14 -0700 Subject: [PATCH] fix elastx cleanup security groups (#11536) Co-authored-by: Kay Yan --- scripts/openstack-cleanup/main.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/openstack-cleanup/main.py b/scripts/openstack-cleanup/main.py index 28820de02..d10e4725b 100755 --- a/scripts/openstack-cleanup/main.py +++ b/scripts/openstack-cleanup/main.py @@ -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, @@ -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())