From 2978b897cf9b9cd39cd60f0b18a38d925764a6f7 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Mon, 26 Aug 2024 14:51:17 +0200 Subject: [PATCH] utilities: Fix juju_reboot for 3.x. Juju 3.x renames `juju-run` to `juju-exec`. Signed-off-by: Frode Nordahl --- unit_tests/utilities/test_zaza_utilities_generic.py | 3 ++- zaza/utilities/generic.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/unit_tests/utilities/test_zaza_utilities_generic.py b/unit_tests/utilities/test_zaza_utilities_generic.py index 038d53e0b..3274c92dd 100644 --- a/unit_tests/utilities/test_zaza_utilities_generic.py +++ b/unit_tests/utilities/test_zaza_utilities_generic.py @@ -213,7 +213,8 @@ def test_juju_reboot(self): generic_utils.juju_reboot(_unit) self.subprocess.check_call.assert_called_once_with( ['juju', 'ssh', _unit, - f'sudo juju-run -u {_unit} "juju-reboot --now"']) + f'sudo juju-run -u {_unit} "juju-reboot --now" || ' + f'sudo juju-exec -u {_unit} "juju-reboot --now"']) def test_run_via_ssh(self): _unit = "app/2" diff --git a/zaza/utilities/generic.py b/zaza/utilities/generic.py index 4addec67b..60afbf174 100644 --- a/zaza/utilities/generic.py +++ b/zaza/utilities/generic.py @@ -519,7 +519,9 @@ def juju_reboot(unit_name): with update-status hooks causing intermittent CI failures). """ cmd = ['juju', 'ssh', unit_name, - 'sudo juju-run -u {} "juju-reboot --now"'.format(unit_name)] + 'sudo juju-run -u {} "juju-reboot --now" || ' + 'sudo juju-exec -u {} "juju-reboot --now"' + .format(unit_name, unit_name)] try: subprocess.check_call(cmd) except subprocess.CalledProcessError as e: