1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fix for issue #230 - handle template taking 3 args

This commit is contained in:
Seth Vidal 2012-04-25 11:59:19 -04:00
parent 283b897a1f
commit fa2aebc8a6
2 changed files with 4 additions and 4 deletions

View file

@ -154,7 +154,7 @@ class PlayBook(object):
include_vars[k] = v include_vars[k] = v
inject_vars = play_vars.copy() inject_vars = play_vars.copy()
inject_vars.update(include_vars) inject_vars.update(include_vars)
included = utils.template_from_file(path, inject_vars) included = utils.template_from_file(path, inject_vars, SETUP_CACHE)
included = utils.parse_yaml(included) included = utils.parse_yaml(included)
for x in included: for x in included:
if len(include_vars): if len(include_vars):
@ -168,7 +168,7 @@ class PlayBook(object):
path = utils.path_dwim(dirname, handler['include']) path = utils.path_dwim(dirname, handler['include'])
inject_vars = self._get_vars(play, dirname) inject_vars = self._get_vars(play, dirname)
included = utils.template_from_file(path, inject_vars) included = utils.template_from_file(path, inject_vars, SETUP_CACHE)
included = utils.parse_yaml(included) included = utils.parse_yaml(included)
for x in included: for x in included:
new_handlers.append(x) new_handlers.append(x)

View file

@ -249,10 +249,10 @@ def template(text, vars, setup_cache):
def double_template(text, vars, setup_cache): def double_template(text, vars, setup_cache):
return template(template(text, vars, setup_cache), vars, setup_cache) return template(template(text, vars, setup_cache), vars, setup_cache)
def template_from_file(path, vars): def template_from_file(path, vars, setup_cache):
''' run a file through the templating engine ''' ''' run a file through the templating engine '''
data = file(path).read() data = file(path).read()
return template(data, vars) return template(data, vars, setup_cache)
def parse_yaml(data): def parse_yaml(data):
return yaml.load(data) return yaml.load(data)