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:
Toshio Kuratomi 2016-11-17 13:18:29 -08:00 committed by GitHub
parent 5d043b65d3
commit ed00741a01
16 changed files with 62 additions and 63 deletions

View file

@ -27,13 +27,13 @@ __metaclass__ = type
import distutils.spawn
import os
import os.path
import pipes
import subprocess
import re
from distutils.version import LooseVersion
import ansible.constants as C
from ansible.compat.six.moves import shlex_quote
from ansible.errors import AnsibleError, AnsibleFileNotFound
from ansible.module_utils._text import to_bytes
from ansible.plugins.connection import ConnectionBase, BUFSIZE
@ -228,7 +228,7 @@ class Connection(ConnectionBase):
raise AnsibleFileNotFound(
"file or module does not exist: %s" % in_path)
out_path = pipes.quote(out_path)
out_path = shlex_quote(out_path)
# Older docker doesn't have native support for copying files into
# running containers, so we use docker exec to implement this
# Although docker version 1.8 and later provide support, the