Verified Commit 8f9f88ae authored by Aleksey Shirokih's avatar Aleksey Shirokih
Browse files

Add migrations. Needs testing

parent 41952d9c
Pipeline #10328 passed with stages
in 39 seconds
......@@ -2,7 +2,9 @@
### Release Notes
* Add TOWER_SSH_KEY_PATH var. Should be used to specify ssh key in case of ed25519 and other types.
* Ansible version bumped to 2.7
* Ansible version bumped to 2.7.5
* Migrate current installations from microservices to release-18.1
## 0.4.4 (2018-08-25)
### Release Notes
......
from __future__ import print_function
from peewee import Model, CharField
import json
def migrate(migrator):
class Environment(Model):
class Meta:
database = migrator.db
db_table = "environment"
name = CharField(unique=True)
class Service(Model):
class Meta:
database = migrator.db
db_table = "service"
if len(Environment.select()) != 0:
for env in Environment.select():
print("Migrating %s" % env.name)
for srv in Service.select().where(Service.environment == env):
if srv.service == 'noc':
conf = json.loads(srv.config)
conf['version'] = conf.get('version', '')
if conf['version'] == 'microservices':
conf['version'] = 'release-18.1'
srv.config = json.dumps(conf, sort_keys=True)
srv.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