Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
fumufu86
tower
Commits
f873a16f
Commit
f873a16f
authored
Mar 27, 2018
by
Aleksey Shirokih
Browse files
Fix migrations
parent
a9d2532a
Changes
4
Hide whitespace changes
Inline
Side-by-side
tower/migrations/030_move_db_settings.py
View file @
f873a16f
...
...
@@ -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
()
...
...
tower/migrations/033_remove_custom.py
View file @
f873a16f
...
...
@@ -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
()
...
...
tower/migrations/035_remove_instances.py
View file @
f873a16f
...
...
@@ -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
()
...
...
tower/migrations/037_config_order_param_settings.py
View file @
f873a16f
...
...
@@ -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
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment