From cb162046f1f568251c801a79e6e6aee8f7b8259f Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Sun, 23 Dec 2012 19:17:07 +0100 Subject: [PATCH] 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. --- fireball | 4 +++- raw | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/fireball b/fireball index 88248d6b001..a3b09f45d86 100644 --- a/fireball +++ b/fireball @@ -149,9 +149,11 @@ def command(data): return dict(failed=True, msg='internal error: cmd is required') if 'tmp_path' not in data: return dict(failed=True, msg='internal error: tmp_path is required') + if 'executable' not in data: + return dict(failed=True, msg='internal error: executable is required') log("executing: %s" % data['cmd']) - p = subprocess.Popen(data['cmd'], shell=True, stdout=subprocess.PIPE, close_fds=True) + p = subprocess.Popen(data['cmd'], executable=data['executable'], shell=True, stdout=subprocess.PIPE, close_fds=True) (stdout, stderr) = p.communicate() if stdout is None: stdout = '' diff --git a/raw b/raw index 061d8eb066a..be81f97dae3 100644 --- a/raw +++ b/raw @@ -4,7 +4,16 @@ DOCUMENTATION = ''' --- module: raw short_description: Executes a low-down and dirty SSH command -options: {} +options: + free_form: + description: + - the raw module takes a free form command to run + required: true + executable: + description: + - change the shell used to execute the command. Should be an absolute path to the executable. + required: false + version_added: "1.0" description: - Executes a low-down and dirty SSH command, not going through the module subsystem. This is useful and should only be done in two cases. The