From e408be67193d4d3554d51c55d5c0f049020fc0de Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Wed, 8 Aug 2018 10:40:45 +0200 Subject: [PATCH] Fix ordering of arguments in call to `async_run_on_unit` Fixes #91 --- unit_tests/test_zaza_model.py | 2 +- zaza/model.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/unit_tests/test_zaza_model.py b/unit_tests/test_zaza_model.py index d06c5d5..e58ae5e 100644 --- a/unit_tests/test_zaza_model.py +++ b/unit_tests/test_zaza_model.py @@ -567,7 +567,7 @@ class TestModel(ut_utils.BaseTestCase): if not rc: raise asyncio.futures.TimeoutError - async def _run_on_unit(model_name, unit_name, cmd, timeout=None): + async def _run_on_unit(unit_name, cmd, model_name=None, timeout=None): return rou_return self.patch_object(model, 'async_run_on_unit') self.async_run_on_unit.side_effect = _run_on_unit diff --git a/zaza/model.py b/zaza/model.py index 445fe8a..b5c49cc 100644 --- a/zaza/model.py +++ b/zaza/model.py @@ -675,28 +675,28 @@ async def async_block_until_service_status(unit_name, services, target_status, or running):: block_until_service_status( - 'modelname', first_unit, ['glance-api'], - 'running') + 'running', + model_name='modelname') - :param model_name: Name of model to query. - :type model_name: str :param unit_name: Name of unit to run action on :type unit_name: str :param services: List of services to check :type services: [] :param target_status: State services should be in (stopped or running) :type target_status: str + :param model_name: Name of model to query. + :type model_name: str :param timeout: Time to wait for status to be achieved :type timeout: int """ async def _check_service(): for service in services: out = await async_run_on_unit( - model_name, unit_name, "pidof -x {}".format(service), + model_name=model_name, timeout=timeout) response_size = len(out['Stdout'].strip()) if target_status == "running" and response_size == 0: