From 4273cb2d8ead8f95fa0032da4082ffd7da338472 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 13 Mar 2014 13:51:10 -0500 Subject: [PATCH] Rejoin args list into a string for run_command when using an unsafe shell This allows the use of an args list with leading environment variables, which otherwise would fail due to the way Popen works. --- lib/ansible/module_utils/basic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index f47347482f6..00dd8011c7e 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1009,7 +1009,9 @@ class AnsibleModule(object): shell = False if isinstance(args, list): - pass + if use_unsafe_shell: + args = " ".join([pipes.quote(x) for x in args]) + shell = True elif isinstance(args, basestring) and use_unsafe_shell: shell = True elif isinstance(args, basestring):