python3 doesn't have raw explicit-unicode literals. Workaround it with a raw native string that we make unicode in py2.

pull/14105/head
Toshio Kuratomi 9 years ago
parent f4d68b8860
commit d0a062ffa3

@ -138,9 +138,9 @@ class Connection(ConnectionBase):
return protocol return protocol
except Exception as e: except Exception as e:
err_msg = to_unicode(e).strip() err_msg = to_unicode(e).strip()
if re.search(ur'Operation\s+?timed\s+?out', err_msg, re.I): if re.search(to_unicode(r'Operation\s+?timed\s+?out'), err_msg, re.I):
raise AnsibleError('the connection attempt timed out') raise AnsibleError('the connection attempt timed out')
m = re.search(ur'Code\s+?(\d{3})', err_msg) m = re.search(to_unicode(r'Code\s+?(\d{3})'), err_msg)
if m: if m:
code = int(m.groups()[0]) code = int(m.groups()[0])
if code == 401: if code == 401:

Loading…
Cancel
Save