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

Fix migrations

parent a9d2532a
......@@ -84,14 +84,17 @@ def migrate(migrator):
config[None]["postgres"] = {
"postgres_db": env.pg_db or "noc",
"postgres_user": env.pg_user or "noc",
"postgres_password": env.pg_password or "noc"
"postgres_password": env.pg_password or "noc",
"superuser_password": config[None]["postgres"].get("superuser_password", "noc"),
"replicator_password": config[None]["postgres"].get("replicator_password", "noc")
}
config[None]["mongod"] = {
"mongod_db": env.mongo_db or "noc",
"mongod_user": env.mongo_user or "noc",
"mongod_password": env.mongo_password or "noc",
"mongod_rs": env.mongo_rs or "noc",
"mongod_engine": env.mongo_engine or "wiredTiger"
"mongod_engine": env.mongo_engine or "wiredTiger",
"mongod_logging_destination": config[None]["mongod"].get("mongod_logging_destination", "file")
}
env.service_config = yaml.dump(config)
env.save()
......
......@@ -52,13 +52,14 @@ def migrate(migrator):
}
match = rx_pk.search(env.cert)
priv_key = env.cert[match.start():match.end()]
pub_key = env.cert[:match.start()] + env.cert[match.end():]
if match:
priv_key = env.cert[match.start():match.end()]
pub_key = env.cert[:match.start()] + env.cert[match.end():]
config[None]["nginx"] = {
"cert": pub_key,
"cert_key": priv_key
}
config[None]["nginx"] = {
"cert": pub_key,
"cert_key": priv_key
}
env.service_config = yaml.dump(config)
env.save()
......
......@@ -120,7 +120,8 @@ def migrate(migrator):
'notebook',
'redis',
'pmwriter',
'dev'
'dev',
'influxdb'
)
consul_template_depend_srv = (
......@@ -223,6 +224,8 @@ def migrate(migrator):
del conf['mongod_rs']
conf['user'] = conf['mongod_user']
del conf['mongod_user']
conf['logging_destination'] = conf['mongod_logging_destination']
del conf['mongod_logging_destination']
if srv.service == 'postgres':
conf['noc_db'] = conf['postgres_db']
del conf['postgres_db']
......@@ -230,6 +233,14 @@ def migrate(migrator):
del conf['postgres_password']
conf['noc_user'] = conf['postgres_user']
del conf['postgres_user']
if srv.service == 'consul':
conf['master_token'] = conf['token']
del conf['token']
if srv.service == 'nginx':
conf['self_signed_cerificate'] = conf['certificate']
del conf['certificate']
conf['json_logging'] = conf['logging']
del conf['logging']
conf["loglevel"] = srv.loglevel
srv.config = json.dumps(conf, sort_keys=True)
srv.save()
......
......@@ -12,5 +12,6 @@ def migrate(migrator):
if len(Environment.select()) != 0:
for env in Environment.select():
env.config_order = "yaml:///opt/noc/etc/tower.yml,yaml:///opt/noc/etc/settings.yml,env:///NOC"
env.save()
if env.config_order == 'legacy:///,yaml:///opt/noc/etc/settings.yml,env:///NOC':
env.config_order = "yaml:///opt/noc/etc/tower.yml,yaml:///opt/noc/etc/settings.yml,env:///NOC"
env.save()
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