mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Check for an empty executable passed into the accelerate plugin
This was breaking at least the script module, so it would seem best to check for it and set it to the default executable value
This commit is contained in:
parent
4bf506f683
commit
20b0dc4abd
2 changed files with 5 additions and 2 deletions
|
@ -138,6 +138,9 @@ class Connection(object):
|
||||||
def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'):
|
def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'):
|
||||||
''' run a command on the remote host '''
|
''' run a command on the remote host '''
|
||||||
|
|
||||||
|
if executable == "":
|
||||||
|
executable = constants.DEFAULT_EXECUTABLE
|
||||||
|
|
||||||
if self.runner.sudo or sudoable and sudo_user:
|
if self.runner.sudo or sudoable and sudo_user:
|
||||||
cmd, prompt = utils.make_sudo_cmd(sudo_user, executable, cmd)
|
cmd, prompt = utils.make_sudo_cmd(sudo_user, executable, cmd)
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
|
||||||
if 'executable' not in data:
|
if 'executable' not in data:
|
||||||
return dict(failed=True, msg='internal error: executable is required')
|
return dict(failed=True, msg='internal error: executable is required')
|
||||||
|
|
||||||
log("executing: %s" % data['cmd'])
|
#log("executing: %s" % data['cmd'])
|
||||||
rc, stdout, stderr = self.server.module.run_command(data['cmd'], executable=data['executable'], close_fds=True)
|
rc, stdout, stderr = self.server.module.run_command(data['cmd'], executable=data['executable'], close_fds=True)
|
||||||
if stdout is None:
|
if stdout is None:
|
||||||
stdout = ''
|
stdout = ''
|
||||||
|
@ -306,7 +306,7 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
|
||||||
log("failed to put the file: %s" % tb)
|
log("failed to put the file: %s" % tb)
|
||||||
return dict(failed=True, stdout="Could not write the file")
|
return dict(failed=True, stdout="Could not write the file")
|
||||||
finally:
|
finally:
|
||||||
log("wrote %d bytes" % bytes)
|
#log("wrote %d bytes" % bytes)
|
||||||
out_fd.close()
|
out_fd.close()
|
||||||
|
|
||||||
if final_path:
|
if final_path:
|
||||||
|
|
Loading…
Reference in a new issue