mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Do not use str() on exceptions (#46950)
This commit is contained in:
parent
2436aa1a4e
commit
a80c25cbd9
30 changed files with 76 additions and 66 deletions
|
@ -20,7 +20,7 @@ DOCUMENTATION = '''
|
|||
import os
|
||||
|
||||
from ansible.constants import TREE_DIR
|
||||
from ansible.module_utils._text import to_bytes
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
from ansible.utils.path import makedirs_safe
|
||||
|
||||
|
@ -53,7 +53,7 @@ class CallbackModule(CallbackBase):
|
|||
with open(path, 'wb+') as fd:
|
||||
fd.write(buf)
|
||||
except (OSError, IOError) as e:
|
||||
self._display.warning("Unable to write to %s's file: %s" % (hostname, str(e)))
|
||||
self._display.warning(u"Unable to write to %s's file: %s" % (hostname, to_text(e)))
|
||||
|
||||
def result_to_tree(self, result):
|
||||
if self.tree:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue