From 98311918a0313f3238fe907b7dab23f76bd6f820 Mon Sep 17 00:00:00 2001 From: Ioan-Adrian Ratiu Date: Wed, 5 Dec 2018 14:21:21 +0200 Subject: [PATCH] restartcheck: fix python 3 bytestring breakage In python 2, bytes is an alias for str and b'foo' == 'foo' so this code used to work, but in python 3 bytes is a separate type, b'foo' != 'foo' so pth.startswith() errors because of the type mismatch: "Passed invalid arguments: startswith first arg must be bytes or a tuple of bytes, not str." Fix this by converting bytes to an unicode string so the code works in both v2 and v3. Signed-off-by: Ioan-Adrian Ratiu --- salt/modules/restartcheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/modules/restartcheck.py b/salt/modules/restartcheck.py index 12812589d77b..426a90e9701e 100644 --- a/salt/modules/restartcheck.py +++ b/salt/modules/restartcheck.py @@ -552,7 +552,7 @@ def restartcheck(ignorelist=None, blacklist=None, excludepid=None, **kwargs): while True: _check_timeout(start_time, timeout) - line = paths.stdout.readline() + line = salt.utils.stringutils.to_unicode(paths.stdout.readline()) if not line: break pth = line[:-1]