From 798c46bc0376f9b401bc25e45ef3be9745cc58f8 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalski Date: Fri, 29 May 2020 14:13:33 +0200 Subject: [PATCH] Handle IPv6 addresses in split_host_port (#1533) This PR makes split_host_port return IPv6 address without enclosing brackets. This is due to the fact that e.g. socket.* functions expect host not to contain them when being called with IPv6. Close: #1532 --- patroni/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/patroni/utils.py b/patroni/utils.py index 7886bd6c..94b98524 100644 --- a/patroni/utils.py +++ b/patroni/utils.py @@ -357,6 +357,8 @@ def polling_loop(timeout, interval=1): def split_host_port(value, default_port): t = value.rsplit(':', 1) + if ':' in t[0]: + t[0] = t[0].strip('[]') t.append(default_port) return t[0], int(t[1])