Migrate basestring to a python3 compatible type (#17199)

This commit is contained in:
Toshio Kuratomi 2016-08-23 13:13:44 -07:00 committed by GitHub
parent a695e18615
commit a22909c226
28 changed files with 137 additions and 101 deletions

View file

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