summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-07-23 21:51:40 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-07-23 22:21:17 +0200
commit1d6834734bda91a99a01d54c4485e022e1fb87a2 (patch)
treecc09c439ed511213328533c46d4829cac751833e
parentc5b8affdabf4de9f758d0ba47547aa78fb004801 (diff)
Create heat_stack_owner if required
It allows testing OpenStack Queens and older [1]. It will be improved in a second change for latest OpenStack releases (if deprecated). [1] https://build.opnfv.org/ci/view/functest/job/functest-apex-baremetal-daily-master/174/console Change-Id: I6e91e8c45d335aa606370c35b0a03b990e22c165 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/opnfv_tests/openstack/shaker/shaker.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/functest/opnfv_tests/openstack/shaker/shaker.py b/functest/opnfv_tests/openstack/shaker/shaker.py
index dfe1d9c98..4f774483b 100644
--- a/functest/opnfv_tests/openstack/shaker/shaker.py
+++ b/functest/opnfv_tests/openstack/shaker/shaker.py
@@ -39,6 +39,10 @@ class Shaker(singlevm.SingleVm2):
ssh_connect_loops = 12
create_server_timeout = 360
+ def __init__(self, **kwargs):
+ super(Shaker, self).__init__(**kwargs)
+ self.role = None
+
def prepare(self):
super(Shaker, self).prepare()
self.cloud.create_security_group_rule(
@@ -58,6 +62,8 @@ class Shaker(singlevm.SingleVm2):
"admin", user=self.project.user.id,
project=self.project.project.id,
domain=self.project.domain.id)
+ if not self.orig_cloud.get_role("heat_stack_owner"):
+ self.role = self.orig_cloud.create_role("heat_stack_owner")
self.orig_cloud.grant_role(
"heat_stack_owner", user=self.project.user.id,
project=self.project.project.id,
@@ -99,3 +105,8 @@ class Shaker(singlevm.SingleVm2):
self.__logger.exception("cannot get report files")
return 1
return stdout.channel.recv_exit_status()
+
+ def clean(self):
+ super(Shaker, self).clean()
+ if self.role:
+ self.orig_cloud.delete_role(self.role.id)