diff --git a/patroni/config.py b/patroni/config.py index 541905a0..947eee41 100644 --- a/patroni/config.py +++ b/patroni/config.py @@ -167,16 +167,23 @@ class Config(object): elif name not in config: config[name] = deepcopy(value) if value else {} - pg_config = config['postgresql'] - # special treatment for old config + + # 'exhibitor' inside 'zookeeper': + if 'zookeeper' in config and 'exhibitor' in config['zookeeper']: + config['exhibitor'] = config['zookeeper'].pop('exhibitor') + config.pop('zookeeper') + + pg_config = config['postgresql'] + # no 'authentication' in 'postgresql', but 'replication' and 'superuser' if 'authentication' not in pg_config: pg_config['use_pg_rewind'] = 'pg_rewind' in pg_config pg_config['authentication'] = {u: pg_config[u] for u in ('replication', 'superuser') if u in pg_config} - + # no 'superuser' in 'postgresql'.'authentication' if 'superuser' not in pg_config['authentication'] and 'pg_rewind' in pg_config: pg_config['authentication']['superuser'] = pg_config['pg_rewind'] + # no 'name' in config if 'name' not in config and 'name' in pg_config: config['name'] = pg_config['name'] diff --git a/tests/test_ha.py b/tests/test_ha.py index ee90eae0..6b5c6deb 100644 --- a/tests/test_ha.py +++ b/tests/test_ha.py @@ -62,6 +62,10 @@ postgresql: pg_rewind: username: postgres password: postgres +zookeeper: + exhibitor: + hosts: [localhost] + port: 8181 """) self.postgresql = p self.dcs = d