From 2f6d97f7618ba087d9a7aa1957cf50e0529f138a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Zettergren?= Date: Fri, 19 Mar 2021 16:14:34 +0100 Subject: [PATCH] fix byte-array / str python3 returns byte-arrays instead of strings for ldap-data in ContextCSNs, which makes the listcomprehension fail with a TypeError when using the --serverID flag like so: CSN = [s for s in contextCSNs if sub in s] TypeError: a bytes-like object is required, not 'str' explicitly encoding 'sub' to byte-array, not sure if this is best way, but seems to work well enough. --- check_syncrepl_extended | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_syncrepl_extended b/check_syncrepl_extended index 70525ec..e92069f 100755 --- a/check_syncrepl_extended +++ b/check_syncrepl_extended @@ -323,7 +323,7 @@ class LdapServer(object): if serverid is False: return contextCSNs[0] csnid = str(format(serverid, 'X')).zfill(3) - sub = '#%s#' % csnid + sub = str.encode('#%s#' % csnid, encoding="ascii", errors="replace") CSN = [s for s in contextCSNs if sub in s] if not CSN: logging.error(