mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00: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:
@@ -21,8 +21,8 @@ __metaclass__ = type
|
||||
import os
|
||||
import time
|
||||
|
||||
from ansible.module_utils._text import to_bytes
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
from ansible.utils.unicode import to_bytes
|
||||
|
||||
try:
|
||||
from junit_xml import TestSuite, TestCase
|
||||
@@ -40,6 +40,7 @@ except ImportError:
|
||||
except ImportError:
|
||||
HAS_ORDERED_DICT = False
|
||||
|
||||
|
||||
class CallbackModule(CallbackBase):
|
||||
"""
|
||||
This callback writes playbook output to a JUnit formatted XML file.
|
||||
@@ -181,7 +182,7 @@ class CallbackModule(CallbackBase):
|
||||
output_file = os.path.join(self._output_dir, '%s-%s.xml' % (self._playbook_name, time.time()))
|
||||
|
||||
with open(output_file, 'wb') as xml:
|
||||
xml.write(to_bytes(report, errors='strict'))
|
||||
xml.write(to_bytes(report, errors='surrogate_or_strict'))
|
||||
|
||||
def v2_playbook_on_start(self, playbook):
|
||||
self._playbook_path = playbook._file_name
|
||||
|
||||
Reference in New Issue
Block a user