Commit dc87e579 authored by Aleksey Shirokih's avatar Aleksey Shirokih
Browse files

Migrate db settings

parent 9ff39ccf
...@@ -67,7 +67,8 @@ def migrate(migrator): ...@@ -67,7 +67,8 @@ def migrate(migrator):
'influxdb', 'influxdb',
'clickhouse', 'clickhouse',
'consultemplate', 'consultemplate',
'monitoring' 'monitoring',
'consul-template'
) )
backaped_services = ( backaped_services = (
'discovery', 'discovery',
...@@ -203,7 +204,27 @@ def migrate(migrator): ...@@ -203,7 +204,27 @@ def migrate(migrator):
if srv.service in consul_template_depend_srv: if srv.service in consul_template_depend_srv:
ct_promote_nodes.add(srv.node) ct_promote_nodes.add(srv.node)
if srv.service == 'grafana':
conf['pg_password'] = conf['password']
del conf['password']
if srv.service == 'mongod':
conf['db'] = conf['mongod_db']
del conf['mongod_db']
conf['engine'] = conf['mongod_engine']
del conf['mongod_engine']
conf['password'] = conf['mongod_password']
del conf['mongod_password']
conf['rs'] = conf['mongod_rs']
del conf['mongod_rs']
conf['user'] = conf['mongod_user']
del conf['mongod_user']
if srv.service == 'postgres':
conf['noc_db'] = conf['postgres_db']
del conf['postgres_db']
conf['noc_password'] = conf['postgres_password']
del conf['postgres_password']
conf['noc_user'] = conf['postgres_user']
del conf['postgres_user']
conf["loglevel"] = srv.loglevel conf["loglevel"] = srv.loglevel
srv.config = json.dumps(conf, sort_keys=True) srv.config = json.dumps(conf, sort_keys=True)
srv.save() srv.save()
...@@ -231,7 +252,6 @@ def migrate(migrator): ...@@ -231,7 +252,6 @@ def migrate(migrator):
config=json.dumps({}, sort_keys=True) config=json.dumps({}, sort_keys=True)
).save() ).save()
migrator.drop_column( migrator.drop_column(
"service", "service",
"n_instances" "n_instances"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment