patroni/debian/patches/urlparse_compat.patch
Michael Banck 9621dc8dc6 * debian/patches/urlparse_compat.patch: New patch, fixes a regression test
suite failure due to a behaviour change in python3's urlparse, taken from
    upstream pull request #1368.
2020-01-23 18:40:49 +01:00

41 lines
1.1 KiB
Diff

From ec67978977634729bb3ac1ffd8d57772818650dd Mon Sep 17 00:00:00 2001
From: Alexander Kukushkin <alexander.kukushkin@zalando.de>
Date: Tue, 21 Jan 2020 14:15:51 +0100
Subject: [PATCH] Compatibility with python 3.7.6
The urlparse function has changed.
Old versions:
```python
>>> urlparse('localhost:8500')
ParseResult(scheme='', netloc='', path='localhost:8500', params='', query='', fragment='')
```
3.7.6:
```python
>>> urlparse('localhost:8500')
ParseResult(scheme='localhost', netloc='', path='8500', params='', query='', fragment='')
```
---
patroni/ctl.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/patroni/ctl.py b/patroni/ctl.py
index 10e14ef6..741d842e 100644
--- a/patroni/ctl.py
+++ b/patroni/ctl.py
@@ -49,11 +49,11 @@ class PatroniCtlException(ClickException):
def parse_dcs(dcs):
if dcs is None:
return None
+ elif '//' not in dcs:
+ dcs = '//' + dcs
parsed = urlparse(dcs)
scheme = parsed.scheme
- if scheme == '' and parsed.netloc == '':
- parsed = urlparse('//' + dcs)
port = int(parsed.port) if parsed.port else None
if scheme == '':