From 1d6834734bda91a99a01d54c4485e022e1fb87a2 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Mon, 23 Jul 2018 21:51:40 +0200 Subject: Create heat_stack_owner if required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- functest/opnfv_tests/openstack/shaker/shaker.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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) -- cgit 1.2.3-korg