mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Mcsalgado's change to use shlex.quote instead of pipes.quote (#18534)
* Replace pipes.quote for shlex_quote * More migration of pipes.quote to shlex_quote Note that we cannot yet move module code over. Modules have six-1.4 bundled which does not have shlex_quote. This shouldn't be a problem as the function is still importable from pipes.quote. It's just that this has become an implementation detail that makes us want to import from shlex instead. Once we get rid of the python2.4 dependency we can update to a newer version of bundled six module-side and then we're free to use shlex_quote everywhere.
This commit is contained in:
@@ -18,11 +18,11 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import pipes
|
||||
import random
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.compat.six import iteritems
|
||||
from ansible.compat.six.moves import shlex_quote
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.plugins.action import ActionBase
|
||||
|
||||
@@ -48,8 +48,6 @@ class ActionModule(ActionBase):
|
||||
|
||||
module_name = self._task.action
|
||||
|
||||
|
||||
|
||||
env_string = self._compute_environment_string()
|
||||
|
||||
module_args = self._task.args.copy()
|
||||
@@ -77,7 +75,7 @@ class ActionModule(ActionBase):
|
||||
elif module_style == 'old':
|
||||
args_data = ""
|
||||
for k, v in iteritems(module_args):
|
||||
args_data += '%s="%s" ' % (k, pipes.quote(to_text(v)))
|
||||
args_data += '%s="%s" ' % (k, shlex_quote(to_text(v)))
|
||||
argsfile = self._transfer_data(self._connection._shell.join_path(tmp, 'arguments'), args_data)
|
||||
|
||||
remote_paths = tmp, remote_module_path, remote_async_module_path
|
||||
|
||||
Reference in New Issue
Block a user