mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Python 3: use six.text_type instead of unicode
Replace 'unicode' with six.text_type, everywhere but in module_utils.
This commit is contained in:
@@ -24,6 +24,8 @@ import ansible.constants as C
|
||||
import time
|
||||
import random
|
||||
|
||||
from six import text_type
|
||||
|
||||
_USER_HOME_PATH_RE = re.compile(r'^~[_.A-Za-z0-9][-_.A-Za-z0-9]*$')
|
||||
|
||||
class ShellModule(object):
|
||||
@@ -40,7 +42,7 @@ class ShellModule(object):
|
||||
LC_MESSAGES = C.DEFAULT_MODULE_LANG,
|
||||
)
|
||||
env.update(kwargs)
|
||||
return ' '.join(['%s=%s' % (k, pipes.quote(unicode(v))) for k,v in env.items()])
|
||||
return ' '.join(['%s=%s' % (k, pipes.quote(text_type(v))) for k,v in env.items()])
|
||||
|
||||
def join_path(self, *args):
|
||||
return os.path.join(*args)
|
||||
|
||||
@@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from six.moves import queue as Queue
|
||||
from six import iteritems
|
||||
from six import iteritems, text_type
|
||||
|
||||
import time
|
||||
|
||||
@@ -168,7 +168,7 @@ class StrategyBase:
|
||||
while not self._final_q.empty() and not self._tqm._terminated:
|
||||
try:
|
||||
result = self._final_q.get(block=False)
|
||||
self._display.debug("got result from result worker: %s" % ([unicode(x) for x in result],))
|
||||
self._display.debug("got result from result worker: %s" % ([text_type(x) for x in result],))
|
||||
|
||||
# all host status messages contain 2 entries: (msg, task_result)
|
||||
if result[0] in ('host_task_ok', 'host_task_failed', 'host_task_skipped', 'host_unreachable'):
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from six import iteritems
|
||||
from six import iteritems, text_type
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.executor.play_iterator import PlayIterator
|
||||
@@ -221,7 +221,7 @@ class StrategyModule(StrategyBase):
|
||||
saved_name = task.name
|
||||
display.debug("done copying, going to template now")
|
||||
try:
|
||||
task.name = unicode(templar.template(task.name, fail_on_undefined=False))
|
||||
task.name = text_type(templar.template(task.name, fail_on_undefined=False))
|
||||
display.debug("done templating")
|
||||
except:
|
||||
# just ignore any errors during task name templating,
|
||||
|
||||
Reference in New Issue
Block a user