mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
In the template module, use utils.template_from_file instead of reimplementing it inline
This commit is contained in:
parent
f8b17ef8d3
commit
e4991d1a61
1 changed files with 2 additions and 3 deletions
|
@ -554,10 +554,9 @@ class Runner(object):
|
||||||
copy_module = self._transfer_module(conn, tmp, 'copy')
|
copy_module = self._transfer_module(conn, tmp, 'copy')
|
||||||
|
|
||||||
# template the source data locally
|
# template the source data locally
|
||||||
source_data = codecs.open(utils.path_dwim(self.basedir, source), encoding="utf8").read()
|
|
||||||
resultant = ''
|
|
||||||
try:
|
try:
|
||||||
resultant = utils.template(source_data, inject, self.setup_cache, no_engine=False)
|
resultant = utils.template_from_file(utils.path_dwim(self.basedir, source),
|
||||||
|
inject, self.setup_cache, no_engine=False)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
return (host, False, dict(failed=True, msg=str(e)), '')
|
return (host, False, dict(failed=True, msg=str(e)), '')
|
||||||
xfered = self._transfer_str(conn, tmp, 'source', resultant)
|
xfered = self._transfer_str(conn, tmp, 'source', resultant)
|
||||||
|
|
Loading…
Reference in a new issue