Add special treatment for zookeeper.exhibitor section

This commit is contained in:
Alexander Kukushkin
2016-06-09 11:19:31 +02:00
parent ce4d814819
commit f576311532
2 changed files with 14 additions and 3 deletions
+10 -3
View File
@@ -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']
+4
View File
@@ -62,6 +62,10 @@ postgresql:
pg_rewind:
username: postgres
password: postgres
zookeeper:
exhibitor:
hosts: [localhost]
port: 8181
""")
self.postgresql = p
self.dcs = d