From 96f64e1c82571348a2c98bacce705f3f9eb37be1 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Tue, 5 Dec 2023 10:45:49 +0100 Subject: [PATCH] utilities/openstack: Fix handling of unit.run for CA check The `async_block_until_ca_exists` function makes direct use of the libjuju APIs which changed in Juju 3.x. Use the action normalise helper from the Zaza model module to reconcile. Signed-off-by: Frode Nordahl --- zaza/openstack/utilities/openstack.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/utilities/openstack.py b/zaza/openstack/utilities/openstack.py index 540b9a3c1..99daefa5b 100644 --- a/zaza/openstack/utilities/openstack.py +++ b/zaza/openstack/utilities/openstack.py @@ -237,8 +237,15 @@ async def _check_ca_present(model, ca_files): for ca_file in ca_files: for unit in units: try: - output = await unit.run('cat {}'.format(ca_file)) - contents = output.data.get('results').get('Stdout', '') + action = await unit.run('cat {}'.format(ca_file)) + action = await action.wait() + # NOTE(fnordahl): yes, this is a call to a private + # function, and to be pragmatic we are already + # mocking about under the hood in this function, so let's + # just make it work. + results = zaza.model._normalise_action_results( + getattr(action, 'results', action.data.get('results'))) + contents = results.get('stdout', '') if ca_cert not in contents: break # libjuju throws a generic error for connection failure. So we