mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
Migrate basestring to a python3 compatible type (#17199)
This commit is contained in:
parent
a695e18615
commit
a22909c226
28 changed files with 137 additions and 101 deletions
|
@ -24,6 +24,7 @@ import os
|
|||
import smtplib
|
||||
import json
|
||||
|
||||
from ansible.compat.six import string_types
|
||||
from ansible.utils.unicode import to_bytes
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
|
||||
|
@ -108,7 +109,7 @@ class CallbackModule(CallbackBase):
|
|||
res = result._result
|
||||
|
||||
sender = '"Ansible: %s" <root>' % host
|
||||
if isinstance(res, basestring):
|
||||
if isinstance(res, string_types):
|
||||
subject = 'Unreachable: %s' % res.strip('\r\n').split('\n')[-1]
|
||||
body = 'An error occurred for host ' + host + ' with the following message:\n\n' + res
|
||||
else:
|
||||
|
@ -123,7 +124,7 @@ class CallbackModule(CallbackBase):
|
|||
res = result._result
|
||||
|
||||
sender = '"Ansible: %s" <root>' % host
|
||||
if isinstance(res, basestring):
|
||||
if isinstance(res, string_types):
|
||||
subject = 'Async failure: %s' % res.strip('\r\n').split('\n')[-1]
|
||||
body = 'An error occurred for host ' + host + ' with the following message:\n\n' + res
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue