Merge pull request #1604 from dhozac/consume-module_vars-early

Template using module_vars early
This commit is contained in:
Michael DeHaan 2012-11-12 08:24:00 -08:00
commit 8f9bef9d51
2 changed files with 5 additions and 1 deletions

View file

@ -149,6 +149,9 @@ class Task(object):
# allow the user to list comma delimited tags # allow the user to list comma delimited tags
import_tags = import_tags.split(",") import_tags = import_tags.split(",")
self.name = utils.template(None, self.name, self.module_vars)
self.action = utils.template(None, self.action, self.module_vars)
# handle mutually incompatible options # handle mutually incompatible options
incompatibles = [ x for x in [ self.first_available_file, self.items_lookup_plugin ] if x is not None ] incompatibles = [ x for x in [ self.first_available_file, self.items_lookup_plugin ] if x is not None ]
if len(incompatibles) > 1: if len(incompatibles) > 1:

View file

@ -215,6 +215,7 @@ def template(basedir, text, vars, expand_lists=False):
except UnicodeEncodeError: except UnicodeEncodeError:
pass # already unicode pass # already unicode
text = varReplace(unicode(text), vars, expand_lists=expand_lists) text = varReplace(unicode(text), vars, expand_lists=expand_lists)
if basedir is not None:
text = _varReplaceLookups(basedir, text, vars) text = _varReplaceLookups(basedir, text, vars)
return text return text