mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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.
This commit is contained in:
parent
4e95ee036e
commit
74b32d9ec0
1 changed files with 3 additions and 1 deletions
|
@ -27,6 +27,8 @@ import socket
|
|||
import sys
|
||||
import time
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
HAS_PSUTIL = False
|
||||
try:
|
||||
import psutil
|
||||
|
@ -509,7 +511,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
|
||||
|
|
Loading…
Reference in a new issue