cloud: Remove '_orchestration_client'

Replace the use of raw clients with a REST request using our normal
clients.

Change-Id: I320ea0f5b1a8147c8e059844fdb9ec3b8f9f2628
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2023-05-26 10:00:02 +01:00
parent 2f5c12dab8
commit fc9ca79242
2 changed files with 7 additions and 16 deletions

View File

@ -28,14 +28,6 @@ def _no_pending_stacks(stacks):
class OrchestrationCloudMixin:
orchestration: Proxy
# TODO(stephenfin): Remove final user of this
@property
def _orchestration_client(self):
if 'orchestration' not in self._raw_clients:
raw_client = self._get_raw_client('orchestration')
self._raw_clients['orchestration'] = raw_client
return self._raw_clients['orchestration']
def get_template_contents(
self,
template_file=None,

View File

@ -16,10 +16,10 @@ import collections
import time
from openstack.cloud import meta
from openstack import proxy
from openstack import exceptions
# TODO(stephenfin): Convert to use proxy
# TODO(stephenfin): Convert to use real resources
def get_events(cloud, stack_id, event_args, marker=None, limit=None):
# TODO(mordred) FIX THIS ONCE assert_calls CAN HANDLE QUERY STRINGS
params = collections.OrderedDict()
@ -31,15 +31,14 @@ def get_events(cloud, stack_id, event_args, marker=None, limit=None):
if limit:
event_args['limit'] = limit
data = proxy._json_response(
cloud._orchestration_client.get(
'/stacks/{id}/events'.format(id=stack_id),
params=params,
)
response = cloud.orchestration.get(
f'/stacks/{stack_id}/events',
params=params,
)
events = meta.get_and_munchify('events', data)
exceptions.raise_from_response(response)
# Show which stack the event comes from (for nested events)
events = meta.get_and_munchify('events', response.json())
for e in events:
e['stack_name'] = stack_id.split("/")[0]
return events