mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Small tweak, don't merge conditionals, just evaluate each in turn.
This commit is contained in:
parent
58f5bfb4c1
commit
d2721526de
2 changed files with 10 additions and 6 deletions
|
@ -230,5 +230,6 @@ class Task(object):
|
|||
self.only_if = utils.compile_when_to_only_if(self.when)
|
||||
|
||||
if additional_conditions:
|
||||
self.only_if = '(' + self.only_if + ') and (' + ' ) and ('.join(additional_conditions) + ')'
|
||||
self.only_if = [ self.only_if ]
|
||||
self.only_if.extend(additional_conditions)
|
||||
|
||||
|
|
|
@ -504,12 +504,15 @@ class Runner(object):
|
|||
else:
|
||||
handler = utils.plugins.action_loader.get('async', self)
|
||||
|
||||
conditional = template.template(self.basedir, self.conditional, inject, expand_lists=False)
|
||||
if type(self.conditional) != list:
|
||||
self.conditional = [ self.conditional ]
|
||||
|
||||
if not utils.check_conditional(conditional):
|
||||
result = utils.jsonify(dict(changed=False, skipped=True))
|
||||
self.callbacks.on_skipped(host, inject.get('item',None))
|
||||
return ReturnData(host=host, result=result)
|
||||
for cond in self.conditional:
|
||||
cond = template.template(self.basedir, cond, inject, expand_lists=False)
|
||||
if not utils.check_conditional(cond):
|
||||
result = utils.jsonify(dict(changed=False, skipped=True))
|
||||
self.callbacks.on_skipped(host, inject.get('item',None))
|
||||
return ReturnData(host=host, result=result)
|
||||
|
||||
conn = None
|
||||
actual_host = inject.get('ansible_ssh_host', host)
|
||||
|
|
Loading…
Reference in a new issue