mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Revert "Allow including files through variables"
This reverts commit bf47bb4753.
Conflicts:
lib/ansible/utils.py
test/TestUtils.py
This commit is contained in:
@@ -200,7 +200,7 @@ class Runner(object):
|
||||
|
||||
cmd = ""
|
||||
if not is_new_style:
|
||||
args = utils.template(self.basedir, args, inject)
|
||||
args = utils.template(args, inject)
|
||||
argsfile = self._transfer_str(conn, tmp, 'arguments', args)
|
||||
if async_jid is None:
|
||||
cmd = "%s %s" % (remote_module_path, argsfile)
|
||||
@@ -258,7 +258,7 @@ class Runner(object):
|
||||
|
||||
items = self.module_vars.get('items', [])
|
||||
if isinstance(items, basestring) and items.startswith("$"):
|
||||
items = utils.varLookup(self.basedir, items, inject)
|
||||
items = utils.varLookup(items, inject)
|
||||
if type(items) != list:
|
||||
raise errors.AnsibleError("with_items only takes a list: %s" % items)
|
||||
|
||||
@@ -327,13 +327,13 @@ class Runner(object):
|
||||
for (k,v) in self.module_args.iteritems():
|
||||
new_args = new_args + "%s='%s' " % (k,v)
|
||||
self.module_args = new_args
|
||||
self.module_args = utils.template(self.basedir, self.module_args, inject)
|
||||
self.module_args = utils.template(self.module_args, inject)
|
||||
|
||||
def _check_conditional(conditional):
|
||||
def is_set(var):
|
||||
return not var.startswith("$")
|
||||
return eval(conditional)
|
||||
conditional = utils.template(self.basedir, self.conditional, inject)
|
||||
conditional = utils.template(self.conditional, inject)
|
||||
if not _check_conditional(conditional):
|
||||
result = utils.jsonify(dict(skipped=True))
|
||||
self.callbacks.on_skipped(host, inject.get('item',None))
|
||||
@@ -352,7 +352,7 @@ class Runner(object):
|
||||
result = dict(failed=True, msg="FAILED: %s" % str(e))
|
||||
return ReturnData(host=host, comm_ok=False, result=result)
|
||||
|
||||
module_name = utils.template(self.basedir, self.module_name, inject)
|
||||
module_name = utils.template(self.module_name, inject)
|
||||
|
||||
tmp = ''
|
||||
if self.module_name != 'raw':
|
||||
@@ -499,7 +499,7 @@ class Runner(object):
|
||||
if module_common.REPLACER in module_data:
|
||||
is_new_style=True
|
||||
module_data = module_data.replace(module_common.REPLACER, module_common.MODULE_COMMON)
|
||||
encoded_args = "\"\"\"%s\"\"\"" % utils.template(self.basedir, self.module_args, inject).replace("\"","\\\"")
|
||||
encoded_args = "\"\"\"%s\"\"\"" % utils.template(self.module_args, inject).replace("\"","\\\"")
|
||||
module_data = module_data.replace(module_common.REPLACER_ARGS, encoded_args)
|
||||
|
||||
# use the correct python interpreter for the host
|
||||
|
||||
@@ -48,7 +48,7 @@ class ActionModule(object):
|
||||
if 'first_available_file' in inject:
|
||||
found = False
|
||||
for fn in inject.get('first_available_file'):
|
||||
fn = utils.template(self.runner.basedir, fn, inject)
|
||||
fn = utils.template(fn, inject)
|
||||
if os.path.exists(fn):
|
||||
source = fn
|
||||
found = True
|
||||
@@ -57,7 +57,7 @@ class ActionModule(object):
|
||||
results=dict(failed=True, msg="could not find src in first_available_file list")
|
||||
return ReturnData(conn=conn, results=results)
|
||||
|
||||
source = utils.template(self.runner.basedir, source, inject)
|
||||
source = utils.template(source, inject)
|
||||
source = utils.path_dwim(self.runner.basedir, source)
|
||||
|
||||
local_md5 = utils.md5(source)
|
||||
|
||||
@@ -44,9 +44,9 @@ class ActionModule(object):
|
||||
return ReturnData(conn=conn, result=results)
|
||||
|
||||
# apply templating to source argument
|
||||
source = utils.template(self.runner.basedir, source, inject)
|
||||
source = utils.template(source, inject)
|
||||
# apply templating to dest argument
|
||||
dest = utils.template(self.runner.basedir, dest, inject)
|
||||
dest = utils.template(dest, inject)
|
||||
|
||||
# files are saved in dest dir, with a subdir for each host, then the filename
|
||||
dest = "%s/%s/%s" % (utils.path_dwim(self.runner.basedir, dest), conn.host, source)
|
||||
|
||||
@@ -51,7 +51,7 @@ class ActionModule(object):
|
||||
if 'first_available_file' in inject:
|
||||
found = False
|
||||
for fn in self.runner.module_vars.get('first_available_file'):
|
||||
fn = utils.template(self.runner.basedir, fn, inject)
|
||||
fn = utils.template(fn, inject)
|
||||
if os.path.exists(fn):
|
||||
source = fn
|
||||
found = True
|
||||
@@ -60,7 +60,7 @@ class ActionModule(object):
|
||||
result = dict(failed=True, msg="could not find src in first_available_file list")
|
||||
return ReturnData(conn=conn, comm_ok=False, result=result)
|
||||
|
||||
source = utils.template(self.runner.basedir, source, inject)
|
||||
source = utils.template(source, inject)
|
||||
|
||||
# template the source data locally & transfer
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user