mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-10 06:35:27 +01:00
Compare commits
5 commits
4a7182b194
...
93cd49adba
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93cd49adba | ||
|
|
0131563ca4 | ||
|
|
dda97be28a | ||
|
|
94089b00f7 | ||
|
|
3cbaff144c |
5 changed files with 24 additions and 16 deletions
8
changelogs/fragments/686_fix_deprecated_imports.yml
Normal file
8
changelogs/fragments/686_fix_deprecated_imports.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
minor_changes:
|
||||
- plugins/action/synchronize.py - fix deprecated ``ansible.module_utils._text`` and ``ansible.module_utils.common._collections_compat`` imports (https://github.com/ansible-collections/ansible.posix/issues/686).
|
||||
- plugins/action/synchronize.py - fix deprecated ``ansible.module_utils.six`` imports for CI compliance.
|
||||
- plugins/modules/synchronize.py - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
|
||||
- plugins/modules/synchronize.py - fix deprecated ``ansible.module_utils.six`` imports for CI compliance.
|
||||
- mount - fix deprecated ``ansible.module_utils._text`` import (https://github.com/ansible-collections/ansible.posix/issues/686).
|
||||
- mount - fix deprecated ``ansible.module_utils.six`` imports for CI compliance.
|
||||
|
|
@ -18,12 +18,11 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
import os.path
|
||||
import shlex
|
||||
from collections.abc import MutableSequence
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.common._collections_compat import MutableSequence
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.plugins.loader import connection_loader
|
||||
|
|
@ -417,7 +416,7 @@ class ActionModule(ActionBase):
|
|||
# Replicate what we do in the module argumentspec handling for lists
|
||||
if not isinstance(_tmp_args.get('rsync_opts'), MutableSequence):
|
||||
tmp_rsync_opts = _tmp_args.get('rsync_opts', [])
|
||||
if isinstance(tmp_rsync_opts, string_types):
|
||||
if isinstance(tmp_rsync_opts, str):
|
||||
tmp_rsync_opts = tmp_rsync_opts.split(',')
|
||||
elif isinstance(tmp_rsync_opts, (int, float)):
|
||||
tmp_rsync_opts = [to_text(tmp_rsync_opts)]
|
||||
|
|
@ -428,13 +427,13 @@ class ActionModule(ActionBase):
|
|||
|
||||
if self._remote_transport in DOCKER + PODMAN:
|
||||
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:
|
||||
_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:
|
||||
_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:
|
||||
_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
|
||||
result.update(self._execute_module('ansible.posix.synchronize', module_args=_tmp_args, task_vars=task_vars))
|
||||
|
|
|
|||
|
|
@ -225,8 +225,7 @@ import platform
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.ansible.posix.plugins.module_utils.mount import ismount
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils._text import to_bytes, to_native
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_native
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
|
||||
|
||||
|
|
@ -279,7 +278,7 @@ def _set_mount_save_old(module, args):
|
|||
old_lines = []
|
||||
exists = False
|
||||
changed = False
|
||||
escaped_args = dict([(k, _escape_fstab(v)) for k, v in iteritems(args)])
|
||||
escaped_args = dict([(k, _escape_fstab(v)) for k, v in args.items()])
|
||||
new_line = '%(src)s %(name)s %(fstype)s %(opts)s %(dump)s %(passno)s\n'
|
||||
|
||||
if platform.system() == 'SunOS':
|
||||
|
|
|
|||
|
|
@ -367,9 +367,13 @@ EXAMPLES = r'''
|
|||
import os
|
||||
import errno
|
||||
|
||||
try:
|
||||
from shlex import quote as shlex_quote
|
||||
except ImportError:
|
||||
from pipes import quote as shlex_quote
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_bytes, to_native
|
||||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_native
|
||||
|
||||
|
||||
client_addr = None
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
tests/utils/shippable/timing.py shebang
|
||||
plugins/action/synchronize.py pylint:ansible-bad-import-from
|
||||
plugins/callback/cgroup_perf_recap.py pylint:ansible-bad-import-from
|
||||
plugins/modules/mount.py pylint:ansible-bad-import-from
|
||||
plugins/modules/sysctl.py pylint:ansible-bad-import-from
|
||||
plugins/shell/csh.py pylint:ansible-bad-import-from
|
||||
plugins/shell/fish.py pylint:ansible-bad-import-from
|
||||
|
|
|
|||
Loading…
Reference in a new issue