Merge "Check no specific group present in group list" into mcp/train
diff --git a/tempest/lib/common/dynamic_creds.py b/tempest/lib/common/dynamic_creds.py
index f27e926..c1df32c 100644
--- a/tempest/lib/common/dynamic_creds.py
+++ b/tempest/lib/common/dynamic_creds.py
@@ -13,6 +13,7 @@
# under the License.
import ipaddress
+import time
import netaddr
from oslo_log import log as logging
@@ -402,11 +403,24 @@
name="default")
secgroups_to_delete = resp_body['security_groups']
for secgroup in secgroups_to_delete:
- try:
- nsg_client.delete_security_group(secgroup['id'])
- except lib_exc.NotFound:
- LOG.warning('Security group %s, id %s not found for clean-up',
- secgroup['name'], secgroup['id'])
+ # Workaround for PRODX-4003
+ attempts = 5
+ for i in range(attempts):
+ try:
+ nsg_client.delete_security_group(secgroup['id'])
+ break
+ except lib_exc.NotFound:
+ LOG.warning('Security group %s, id %s not found for '
+ 'clean-up', secgroup['name'], secgroup['id'])
+ break
+ except lib_exc.Conflict:
+ LOG.warning('Conflict with state of security group %s, '
+ 'id %s.', secgroup['name'], secgroup['id'])
+ if i == attempts - 1:
+ raise
+ else:
+ time.sleep(1)
+ continue
def _clear_isolated_net_resources(self):
client = self.routers_admin_client