mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Added executable parameter to the script module (#36969)
* Added interpreter parameter to the script module * Let required and default parameters get documented implicitly for binary parameter * Renamed interpreter parameter to executable
This commit is contained in:
parent
43ca9d1548
commit
04e3c964fb
4 changed files with 43 additions and 1 deletions
|
@ -79,6 +79,9 @@ class ActionModule(ActionBase):
|
|||
parts = [to_text(s, errors='surrogate_or_strict') for s in shlex.split(raw_params.strip())]
|
||||
source = parts[0]
|
||||
|
||||
# Support executable paths and files with spaces in the name.
|
||||
executable = to_native(self._task.args.get('executable', ''), errors='surrogate_or_strict')
|
||||
|
||||
try:
|
||||
source = self._loader.get_real_file(self._find_needle('files', source), decrypt=self._task.args.get('decrypt', True))
|
||||
except AnsibleError as e:
|
||||
|
@ -109,7 +112,11 @@ class ActionModule(ActionBase):
|
|||
# add preparation steps to one ssh roundtrip executing the script
|
||||
env_dict = dict()
|
||||
env_string = self._compute_environment_string(env_dict)
|
||||
script_cmd = ' '.join([env_string, target_command])
|
||||
|
||||
if executable:
|
||||
script_cmd = ' '.join([env_string, executable, target_command])
|
||||
else:
|
||||
script_cmd = ' '.join([env_string, target_command])
|
||||
|
||||
if self._play_context.check_mode:
|
||||
raise _AnsibleActionDone()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue