From 20b0dc4abdc6eec6c485d799b747912bdc6da50a Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 5 Sep 2013 15:11:26 -0500 Subject: [PATCH] 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 --- lib/ansible/runner/connection_plugins/accelerate.py | 3 +++ library/utilities/accelerate | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/connection_plugins/accelerate.py b/lib/ansible/runner/connection_plugins/accelerate.py index 1243e5987b..f835a7dee8 100644 --- a/lib/ansible/runner/connection_plugins/accelerate.py +++ b/lib/ansible/runner/connection_plugins/accelerate.py @@ -138,6 +138,9 @@ class Connection(object): def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'): ''' run a command on the remote host ''' + if executable == "": + executable = constants.DEFAULT_EXECUTABLE + if self.runner.sudo or sudoable and sudo_user: cmd, prompt = utils.make_sudo_cmd(sudo_user, executable, cmd) diff --git a/library/utilities/accelerate b/library/utilities/accelerate index cccc4793b0..3987e4ac1d 100644 --- a/library/utilities/accelerate +++ b/library/utilities/accelerate @@ -217,7 +217,7 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler): if 'executable' not in data: 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) if stdout is None: stdout = '' @@ -306,7 +306,7 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler): log("failed to put the file: %s" % tb) return dict(failed=True, stdout="Could not write the file") finally: - log("wrote %d bytes" % bytes) + #log("wrote %d bytes" % bytes) out_fd.close() if final_path: