Skip to content

Commit

Permalink
Switch to use action status to determin if wait
Browse files Browse the repository at this point in the history
  • Loading branch information
rgildein committed Apr 15, 2024
1 parent 8ff3f48 commit 112238d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zaza/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ async def async_run_on_unit(unit_name, command, model_name=None, timeout=None):
model = await get_model(model_name)
unit = await async_get_unit_from_name(unit_name, model)
action = await unit.run(command, timeout=timeout)
if inspect.isawaitable(action):
if action.status == "pending":
await action.wait()
action = _normalise_action_object(action)
results = action.data.get('results')
Expand Down Expand Up @@ -599,7 +599,7 @@ async def async_run_on_leader(application_name, command, model_name=None,
is_leader = await unit.is_leader_from_status()
if is_leader:
action = await unit.run(command, timeout=timeout)
if inspect.isawaitable(action):
if action.status == "pending":
await action.wait()
action = _normalise_action_object(action)
results = action.data.get('results')
Expand Down Expand Up @@ -2160,7 +2160,7 @@ async def _check_file():
for unit in units:
try:
output = await unit.run('cat {}'.format(remote_file))
if inspect.isawaitable(output):
if output.status == "pending":
await output.wait()
results = {}
try:
Expand Down Expand Up @@ -2302,7 +2302,7 @@ async def _check_for_file(model):
for unit in units:
try:
output = await unit.run('test -e "{}"; echo $?'.format(path))
if inspect.isawaitable(output):
if output.status == "pending":
await output.wait()
output = _normalise_action_object(output)
output_result = _normalise_action_results(
Expand Down

0 comments on commit 112238d

Please sign in to comment.