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
|
@ -70,6 +70,7 @@ try:
|
|||
except ImportError:
|
||||
HAS_REQUESTS = False
|
||||
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
|
||||
|
||||
|
@ -152,7 +153,7 @@ class CallbackModule(CallbackBase):
|
|||
verify=self.ssl_verify)
|
||||
r.raise_for_status()
|
||||
except requests.exceptions.RequestException as err:
|
||||
print(str(err))
|
||||
print(to_text(err))
|
||||
|
||||
def _build_log(self, data):
|
||||
logs = []
|
||||
|
@ -214,7 +215,7 @@ class CallbackModule(CallbackBase):
|
|||
verify=self.ssl_verify)
|
||||
r.raise_for_status()
|
||||
except requests.exceptions.RequestException as err:
|
||||
print(str(err))
|
||||
print(to_text(err))
|
||||
self.items[host] = []
|
||||
|
||||
def append_result(self, result):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue