diff --git a/patroni/dcs/consul.py b/patroni/dcs/consul.py index 278262b0..ded2776e 100644 --- a/patroni/dcs/consul.py +++ b/patroni/dcs/consul.py @@ -299,7 +299,7 @@ class Consul(AbstractDCS): nodes = {} for node in results: node['Value'] = (node['Value'] or b'').decode('utf-8') - nodes[os.path.relpath(node['Key'], path).replace('\\', '/')] = node + nodes[node['Key'][len(path):].lstrip('/')] = node # get initialize flag initialize = nodes.get(self._INITIALIZE) diff --git a/patroni/dcs/etcd.py b/patroni/dcs/etcd.py index a133538c..5fbf0f34 100644 --- a/patroni/dcs/etcd.py +++ b/patroni/dcs/etcd.py @@ -454,7 +454,7 @@ class Etcd(AbstractDCS): def _load_cluster(self): try: result = self.retry(self._client.read, self.client_path(''), recursive=True) - nodes = {os.path.relpath(node.key, result.key).replace('\\', '/'): node for node in result.leaves} + nodes = {node.key[len(result.key):].lstrip('/'): node for node in result.leaves} # get initialize flag initialize = nodes.get(self._INITIALIZE)