mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 06:30:19 -07:00
Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because of licensing. So once created it we had two sets of functions that did the same things but had different implementations. To remedy that, this change removes the ansible.utils.unicode versions of those functions.
This commit is contained in:
parent
7a9395b5e0
commit
4ed88512e4
89 changed files with 759 additions and 894 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
# (c) 2015 Toshio Kuratomi <tkuratomi@ansible.com>
|
||||
#
|
||||
# This file is part of Ansible
|
||||
|
@ -32,8 +31,9 @@ from ansible.compat.six import with_metaclass
|
|||
from ansible import constants as C
|
||||
from ansible.compat.six import string_types
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.plugins import shell_loader
|
||||
from ansible.utils.unicode import to_bytes, to_unicode
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
|
@ -138,9 +138,9 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
|
|||
# exception, it merely mangles the output:
|
||||
# >>> shlex.split(u't e')
|
||||
# ['t\x00\x00\x00', '\x00\x00\x00e\x00\x00\x00']
|
||||
return [to_unicode(x.strip()) for x in shlex.split(to_bytes(argstring)) if x.strip()]
|
||||
return [to_text(x.strip()) for x in shlex.split(to_bytes(argstring)) if x.strip()]
|
||||
except AttributeError:
|
||||
return [to_unicode(x.strip()) for x in shlex.split(argstring) if x.strip()]
|
||||
return [to_text(x.strip()) for x in shlex.split(argstring) if x.strip()]
|
||||
|
||||
@abstractproperty
|
||||
def transport(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue