mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Force all args to strings for 'command' (fixes #43732)
This commit is contained in:
committed by
Toshio Kuratomi
parent
9a8bae5b67
commit
9f9e936d3c
@@ -133,6 +133,8 @@ import os
|
||||
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):
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user