Introduce the 'always_run' task clause.

The 'always_run' task clause allows one to execute a task even in
check mode.

While here implement Runner.noop_on_check() to check if a runner
really should execute its task, with respect to check mode option
and 'always_run' clause.

Also add the optional 'jinja2' argument to check_conditional() :
it allows to give this function a jinja2 expression without exposing
the 'jinja2_compare' implementation mechanism.
This commit is contained in:
Stoned Elipot
2013-08-20 23:09:44 +02:00
parent 7ac3bbc198
commit f0743fc32a
14 changed files with 136 additions and 13 deletions

View File

@@ -155,7 +155,10 @@ def is_changed(result):
return (result.get('changed', False) in [ True, 'True', 'true'])
def check_conditional(conditional, basedir, inject, fail_on_undefined=False):
def check_conditional(conditional, basedir, inject, fail_on_undefined=False, jinja2=False):
if jinja2:
conditional = "jinja2_compare %s" % conditional
if conditional.startswith("jinja2_compare"):
conditional = conditional.replace("jinja2_compare ","")