mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 07:05:27 +01:00
Compare commits
2 commits
93cd49adba
...
64a81b4064
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64a81b4064 | ||
|
|
87307a91a2 |
2 changed files with 8 additions and 5 deletions
|
|
@ -18,8 +18,8 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import shlex
|
|
||||||
from collections.abc import MutableSequence
|
from collections.abc import MutableSequence
|
||||||
|
from shlex import quote as shlex_quote
|
||||||
|
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.module_utils.common.text.converters import to_text
|
from ansible.module_utils.common.text.converters import to_text
|
||||||
|
|
@ -427,13 +427,13 @@ class ActionModule(ActionBase):
|
||||||
|
|
||||||
if self._remote_transport in DOCKER + PODMAN:
|
if self._remote_transport in DOCKER + PODMAN:
|
||||||
if become and self._play_context.become_user:
|
if become and self._play_context.become_user:
|
||||||
_tmp_args['rsync_opts'].append('--rsh=' + shlex.quote('%s exec -u %s -i' % (self._docker_cmd, self._play_context.become_user)))
|
_tmp_args['rsync_opts'].append('--rsh=' + shlex_quote('%s exec -u %s -i' % (self._docker_cmd, self._play_context.become_user)))
|
||||||
elif user is not None:
|
elif user is not None:
|
||||||
_tmp_args['rsync_opts'].append('--rsh=' + shlex.quote('%s exec -u %s -i' % (self._docker_cmd, user)))
|
_tmp_args['rsync_opts'].append('--rsh=' + shlex_quote('%s exec -u %s -i' % (self._docker_cmd, user)))
|
||||||
else:
|
else:
|
||||||
_tmp_args['rsync_opts'].append('--rsh=' + shlex.quote('%s exec -i' % self._docker_cmd))
|
_tmp_args['rsync_opts'].append('--rsh=' + shlex_quote('%s exec -i' % self._docker_cmd))
|
||||||
elif self._remote_transport in BUILDAH:
|
elif self._remote_transport in BUILDAH:
|
||||||
_tmp_args['rsync_opts'].append('--rsh=' + shlex.quote('buildah run --'))
|
_tmp_args['rsync_opts'].append('--rsh=' + shlex_quote('buildah run --'))
|
||||||
|
|
||||||
# run the module and store the result
|
# run the module and store the result
|
||||||
result.update(self._execute_module('ansible.posix.synchronize', module_args=_tmp_args, task_vars=task_vars))
|
result.update(self._execute_module('ansible.posix.synchronize', module_args=_tmp_args, task_vars=task_vars))
|
||||||
|
|
|
||||||
|
|
@ -367,6 +367,9 @@ EXAMPLES = r'''
|
||||||
import os
|
import os
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
|
# TODO(Python2): shlex.quote was added in Python 3.3. This module may run on
|
||||||
|
# target hosts with Python 2.7 (e.g., older RHEL systems in CI integration tests).
|
||||||
|
# Remove the try/except fallback to pipes.quote when Python 2 support is dropped.
|
||||||
try:
|
try:
|
||||||
from shlex import quote as shlex_quote
|
from shlex import quote as shlex_quote
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue