mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
parent
29a9b8ab7d
commit
66a8864ae9
6 changed files with 31 additions and 20 deletions
|
@ -81,11 +81,20 @@ class ActionBase:
|
|||
Builds the environment string to be used when executing the remote task.
|
||||
'''
|
||||
|
||||
if self._task.environment:
|
||||
if type(self._task.environment) != dict:
|
||||
raise errors.AnsibleError("environment must be a dictionary, received %s" % self._task.environment)
|
||||
final_environment = dict()
|
||||
if self._task.environment is not None:
|
||||
environments = self._task.environment
|
||||
if not isinstance(environments, list):
|
||||
environments = [ environments ]
|
||||
|
||||
return self._connection._shell.env_prefix(**self._task.environment)
|
||||
for environment in environments:
|
||||
if type(environment) != dict:
|
||||
raise errors.AnsibleError("environment must be a dictionary, received %s" % environment)
|
||||
# very deliberatly using update here instead of combine_vars, as
|
||||
# these environment settings should not need to merge sub-dicts
|
||||
final_environment.update(environment)
|
||||
|
||||
return self._connection._shell.env_prefix(**final_environment)
|
||||
|
||||
def _early_needs_tmp_path(self):
|
||||
'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue