Skip to content

Commit

Permalink
[DEVOPS-646] Fixed wait condition
Browse files Browse the repository at this point in the history
- Failed tasks are also complete!
  • Loading branch information
yusufhm committed Oct 22, 2024
1 parent c24c6d9 commit 0ca5558
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/plugins/action/mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def run(self, tmp=None, task_vars=None):
wait = self._task.args.get('wait', False)
waitCondition = self._task.args.get('waitCondition', {
'field': 'status',
'value': 'complete',
'value': ['complete', 'failed'],
})

with self.client:
Expand Down Expand Up @@ -69,5 +69,8 @@ def waitQuery(self, qryName, waitQry, waitCondition) -> Dict[str, Any]:

def evaluateWaitCondition(self, qryName, waitResult, waitCondition) -> bool:
if waitCondition["field"] in waitResult[qryName]:
return waitResult[qryName][waitCondition["field"]] == waitCondition["value"]
if isinstance(waitCondition["value"], list):
return waitResult[qryName][waitCondition["field"]] in waitCondition["value"]
else:
return waitResult[qryName][waitCondition["field"]] == waitCondition["value"]
return False

0 comments on commit 0ca5558

Please sign in to comment.