Allow the environment string to be referenced by a bare variable name like:
environment: foo
This commit is contained in:
parent
f16751de29
commit
fbea88b9d9
1 changed files with 3 additions and 1 deletions
|
@ -240,6 +240,8 @@ class Runner(object):
|
||||||
if not self.environment:
|
if not self.environment:
|
||||||
return ""
|
return ""
|
||||||
enviro = template.template(self.basedir, self.environment, inject)
|
enviro = template.template(self.basedir, self.environment, inject)
|
||||||
|
if isinstance(enviro, basestring) and enviro in inject:
|
||||||
|
enviro = inject[enviro]
|
||||||
if type(enviro) != dict:
|
if type(enviro) != dict:
|
||||||
raise errors.AnsibleError("environment must be a dictionary, received %s" % enviro)
|
raise errors.AnsibleError("environment must be a dictionary, received %s" % enviro)
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -292,7 +294,7 @@ class Runner(object):
|
||||||
if not shebang:
|
if not shebang:
|
||||||
raise errors.AnsibleError("module is missing interpreter line")
|
raise errors.AnsibleError("module is missing interpreter line")
|
||||||
|
|
||||||
cmd = " ".join([environment_string, shebang.replace("#!",""), cmd])
|
cmd = " ".join([environment_string.strip(), shebang.replace("#!","").strip(), cmd])
|
||||||
cmd = cmd.strip()
|
cmd = cmd.strip()
|
||||||
|
|
||||||
if tmp.find("tmp") != -1 and C.DEFAULT_KEEP_REMOTE_FILES != '1' and not persist_files:
|
if tmp.find("tmp") != -1 and C.DEFAULT_KEEP_REMOTE_FILES != '1' and not persist_files:
|
||||||
|
|
Loading…
Reference in a new issue