Do not use str() on exceptions (#46950)

This commit is contained in:
Martin Krizek 2018-11-09 07:59:30 +01:00 committed by GitHub
parent 2436aa1a4e
commit a80c25cbd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 76 additions and 66 deletions

View file

@ -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: