Revert "enable run_command to use non /bin/sh shells"
This breaks output from commands in current playbooks. Since this
change fixed a smaller use case we're going to revert this for 2.4.1 and
revisit a different fix for non /bin/sh shells for 2.5.x
This reverts commit 55135c0825
.
This commit is contained in:
parent
b15ff222b1
commit
bc6483c96a
1 changed files with 9 additions and 17 deletions
|
@ -2601,14 +2601,14 @@ class AnsibleModule(object):
|
|||
strings on python3, use encoding=None to turn decoding to text off.
|
||||
'''
|
||||
|
||||
shell = False
|
||||
if isinstance(args, list):
|
||||
if use_unsafe_shell:
|
||||
args = " ".join([pipes.quote(x) for x in args])
|
||||
args = " ".join([shlex_quote(x) for x in args])
|
||||
shell = True
|
||||
elif isinstance(args, (binary_type, text_type)) and use_unsafe_shell:
|
||||
shell = True
|
||||
elif isinstance(args, (binary_type, text_type)):
|
||||
if not use_unsafe_shell:
|
||||
# On python2.6 and below, shlex has problems with text type
|
||||
# On python3, shlex needs a text type.
|
||||
if PY2:
|
||||
|
@ -2620,14 +2620,6 @@ class AnsibleModule(object):
|
|||
msg = "Argument 'args' to run_command must be list or string"
|
||||
self.fail_json(rc=257, cmd=args, msg=msg)
|
||||
|
||||
shell = False
|
||||
if use_unsafe_shell:
|
||||
executable = os.environ.get('SHELL')
|
||||
if executable:
|
||||
args = [executable, '-c', args]
|
||||
else:
|
||||
shell = True
|
||||
|
||||
prompt_re = None
|
||||
if prompt_regex:
|
||||
if isinstance(prompt_regex, text_type):
|
||||
|
|
Loading…
Reference in a new issue