Merge pull request #363 from jhoekx/template-only-if

Fix correct variable expansion in includes only_if.
This commit is contained in:
Michael DeHaan 2012-05-11 15:55:09 -07:00
commit f8807da57b
6 changed files with 61 additions and 6 deletions

View file

@ -262,14 +262,15 @@ class Runner(object):
async_jid=None, async_module=None, async_limit=None):
''' runs a module that has already been transferred '''
inject = self.setup_cache.get(conn.host,{})
inject = self.setup_cache.get(conn.host,{}).copy()
host_variables = self.inventory.get_variables(conn.host)
inject.update(host_variables)
inject.update(self.module_vars)
conditional = utils.double_template(self.conditional, inject, self.setup_cache)
if not eval(conditional):
return [ utils.smjson(dict(skipped=True)), None, 'skipped' ]
host_variables = self.inventory.get_variables(conn.host)
inject.update(host_variables)
if self.module_name == 'setup':
args = self._add_setup_vars(inject, args)
args = self._add_setup_metadata(args)