Skip to content

Commit

Permalink
Force all args to strings for 'command' (fixes ansible#43732)
Browse files Browse the repository at this point in the history
  • Loading branch information
agaffney authored and abadger committed Aug 6, 2018
1 parent 9a8bae5 commit 9f9e936
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ansible/modules/commands/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
import shlex

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
from ansible.module_utils.common.collections import is_iterable


def check_command(module, commandline):
Expand Down Expand Up @@ -215,6 +217,10 @@ def main():

args = args or argv

# All args must be strings
if is_iterable(args, include_strings=False):
args = [to_native(arg, errors='surrogate_or_strict', nonstring='simplerepr') for arg in args]

if chdir:
chdir = os.path.abspath(chdir)
os.chdir(chdir)
Expand Down

0 comments on commit 9f9e936

Please sign in to comment.