mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00: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:
@@ -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)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user