summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-09-24 06:28:21 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-09-24 06:32:16 +0200
commit4aa92eebba7f8a499d48abbfd50e899b0e152413 (patch)
tree5c5fa873354e0824bae5a6ecbeefa9b5c90937a5
parentb11fbcb9971f6aedc668901d6ba82517ce9d819e (diff)
Protect if default secgroup not created
https://build.opnfv.org/ci/view/functest/job/functest-compass-virtual-daily-master/lastFailedBuild/console Change-Id: I2b5f1dc577f98773ad40ed3bcfff609d8d6c4b93 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 5bb60b33a8fad4859b7391576fdfed7cec4c14a8)
-rw-r--r--functest/core/tenantnetwork.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/functest/core/tenantnetwork.py b/functest/core/tenantnetwork.py
index e9ac6d3ba..e03740767 100644
--- a/functest/core/tenantnetwork.py
+++ b/functest/core/tenantnetwork.py
@@ -106,10 +106,12 @@ class NewProject(object):
self.orig_cloud.delete_project(self.project.id)
if self.role:
self.orig_cloud.delete_role(self.role.id)
- sec_id = self.orig_cloud.list_security_groups(
+ secgroups = self.orig_cloud.list_security_groups(
filters={'name': 'default',
- 'project_id': self.project.id})[0].id
- self.orig_cloud.delete_security_group(sec_id)
+ 'project_id': self.project.id})
+ if secgroups:
+ sec_id = secgroups[0].id
+ self.orig_cloud.delete_security_group(sec_id)
except Exception: # pylint: disable=broad-except
self.__logger.exception("Cannot clean all resources")