mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-18 06:11:07 -07:00
Allow to change executable (shell/interpreter) when using raw
This patch adds an optional 'executable=' option to the raw command line to override the default shell (/bin/sh), much like the shell module does.
This commit is contained in:
parent
3d3deb9797
commit
846161a1a4
8 changed files with 51 additions and 24 deletions
|
@ -34,7 +34,15 @@ class ActionModule(object):
|
|||
self.runner = runner
|
||||
|
||||
def run(self, conn, tmp, module_name, module_args, inject):
|
||||
return ReturnData(conn=conn,
|
||||
result=self.runner._low_level_exec_command(conn, module_args.encode('utf-8'), tmp, sudoable=True)
|
||||
)
|
||||
executable = None
|
||||
args = []
|
||||
for arg in module_args.split(' '):
|
||||
if arg.startswith('executable='):
|
||||
executable = '='.join(arg.split('=')[1:])
|
||||
else:
|
||||
args.append(arg)
|
||||
module_args = ' '.join(args).encode('utf-8')
|
||||
|
||||
return ReturnData(conn=conn,
|
||||
result=self.runner._low_level_exec_command(conn, module_args, tmp, sudoable=True, executable=executable)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue