diff options
author | zaiusdr <eduardosuarez@gmail.com> | 2016-11-10 16:55:58 +0100 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-11-18 12:47:00 -0800 |
commit | f01504529df668db0fe4a95231e54c9d5b872987 (patch) | |
tree | b4623a113dd00ce5ed459147fcdef888b251c6ae | |
parent | 9fcc48e87a45624b6c7a017aaef05a67094b615e (diff) | |
download | ansible-modules-core-f01504529df668db0fe4a95231e54c9d5b872987.tar.gz |
Fix wait_for Module to handle socket response as string in Python3
In Python3 socket module returns responses as bytes type. So it's
necessary to convert it to string for the module work correctly.
(cherry picked from commit 7ed1af0a6d3f5e852a21aeb0b310ec71fddb2b28)
-rw-r--r-- | utilities/logic/wait_for.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/utilities/logic/wait_for.py b/utilities/logic/wait_for.py index d1cf928a..74154640 100644 --- a/utilities/logic/wait_for.py +++ b/utilities/logic/wait_for.py @@ -27,6 +27,8 @@ import socket import sys import time +from ansible.module_utils._text import to_native + HAS_PSUTIL = False try: import psutil @@ -480,7 +482,7 @@ def main(): if not response: # Server shutdown break - data += response + data += to_native(response, errors='surrogate_or_strict') if re.search(compiled_search_re, data): matched = True break |