Small tweak, don't merge conditionals, just evaluate each in turn.

pull/3259/merge
Michael DeHaan 12 years ago
parent 58f5bfb4c1
commit d2721526de

@ -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 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)
if type(self.conditional) != list:
self.conditional = [ self.conditional ]
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…
Cancel
Save