Fix ordering of arguments in call to async_run_on_unit

Fixes #91
This commit is contained in:
Frode Nordahl
2018-08-08 10:40:45 +02:00
parent 31b68a7806
commit e408be6719
2 changed files with 6 additions and 6 deletions

View File

@@ -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

View File

@@ -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: