From eb9fb0a05a5f82d993895a7b945380d9cd81b921 Mon Sep 17 00:00:00 2001 From: Omer Date: Wed, 3 Nov 2021 14:31:11 +0100 Subject: [PATCH] Fix Octavia no 'loadbalancer' AttributeError This patch fixes Octavia AttributeError has no attribute 'loadbalancer' on test_faults. Change-Id: I367c8117f6d042693704f700676620cb345b2ea4 --- tobiko/openstack/stacks/_octavia.py | 14 ++++++++------ tobiko/tests/faults/octavia/test_faults.py | 7 ++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tobiko/openstack/stacks/_octavia.py b/tobiko/openstack/stacks/_octavia.py index c16987878..6af03774f 100644 --- a/tobiko/openstack/stacks/_octavia.py +++ b/tobiko/openstack/stacks/_octavia.py @@ -105,19 +105,21 @@ class OctaviaLoadbalancerStackFixture(heat.HeatStackFixture): else: return self.vip_network.ipv6_subnet_id - def wait_for_active_loadbalancer(self, **kwargs): + def wait_for_active_loadbalancer(self): + loadbalancer_id = self.stack.output_show( + 'loadbalancer_id')['output']['output_value'] octavia.wait_for_status(status_key=octavia.PROVISIONING_STATUS, status=octavia.ACTIVE, get_client=octavia.get_loadbalancer, - object_id=self.loadbalancer.loadbalancer_id, - **kwargs) + object_id=loadbalancer_id) - def wait_for_update_loadbalancer(self, **kwargs): + def wait_for_update_loadbalancer(self): + loadbalancer_id = self.stack.output_show( + 'loadbalancer_id')['output']['output_value'] octavia.wait_for_status(status_key=octavia.PROVISIONING_STATUS, status=octavia.PENDING_UPDATE, get_client=octavia.get_loadbalancer, - object_id=self.loadbalancer.loadbalancer_id, - **kwargs) + object_id=loadbalancer_id) class OctaviaListenerStackFixture(heat.HeatStackFixture): diff --git a/tobiko/tests/faults/octavia/test_faults.py b/tobiko/tests/faults/octavia/test_faults.py index 3f02410ac..c25f5b5d4 100644 --- a/tobiko/tests/faults/octavia/test_faults.py +++ b/tobiko/tests/faults/octavia/test_faults.py @@ -90,9 +90,7 @@ class OctaviaBasicFaultTest(testtools.TestCase): # Wait for the LB to be updated try: - self.loadbalancer_stack.wait_for_update_loadbalancer( - loadbalancer_id=self.loadbalancer_stack.loadbalancer_id, - timeout=30) + self.loadbalancer_stack.wait_for_update_loadbalancer(timeout=30) except tobiko.RetryTimeLimitError: LOG.info('The restarted servers reached ACTIVE status after the' @@ -100,8 +98,7 @@ class OctaviaBasicFaultTest(testtools.TestCase): ' being raised even though the update timeout was' ' reached.') - self.loadbalancer_stack.wait_for_active_loadbalancer( - loadbalancer_id=self.loadbalancer_stack.loadbalancer_id) + self.loadbalancer_stack.wait_for_active_loadbalancer() LOG.debug(f'Load Balancer {self.loadbalancer_stack.loadbalancer_id} is' f' ACTIVE')