Commit 1f3113f2 authored by EKbfh's avatar EKbfh 🐼
Browse files

Merge branch 'py3' into 'master'

Python3

See merge request !48
parents c3d54953 e7bac1e0
Pipeline #23004 passed with stages
in 7 minutes and 38 seconds
from __future__ import print_function
from builtins import object
from peewee import Model, CharField, TextField, BooleanField
import yaml
import re
......@@ -13,7 +14,7 @@ def migrate(migrator):
)
class Environment(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "environment"
......@@ -60,7 +61,7 @@ def migrate(migrator):
"cert": pub_key,
"cert_key": priv_key
}
env.service_config = yaml.dump(config)
env.service_config = yaml.dump(config.decode("utf-8"))
env.save()
migrator.drop_column(
......
from __future__ import print_function
from builtins import object
from peewee import Model, CharField, ForeignKeyField, TextField, IntegerField
import yaml
import json
......@@ -6,7 +7,7 @@ import json
def migrate(migrator):
class Environment(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "environment"
......@@ -14,7 +15,7 @@ def migrate(migrator):
service_config = TextField(default="")
class Node(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "node"
......@@ -22,7 +23,7 @@ def migrate(migrator):
environment = ForeignKeyField(Environment, on_delete="RESTRICT")
class Pool(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "pool"
......@@ -30,7 +31,7 @@ def migrate(migrator):
name = CharField()
class Service(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "service"
......@@ -65,7 +66,7 @@ def migrate(migrator):
for pool in config:
for srv in config[pool]:
cfg = config[pool][srv]
q = Service.update(config=json.dumps(cfg, sort_keys=True)).where(
q = Service.update(config=json.dumps(cfg.decode("utf-8"), sort_keys=True)).where(
Service.environment == env.id,
Service.service == srv,
Service.pool == pool
......
from __future__ import print_function
from builtins import object
from peewee import Model, CharField, ForeignKeyField, TextField, IntegerField, BooleanField
import json
def migrate(migrator):
class Environment(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "environment"
......@@ -13,7 +14,7 @@ def migrate(migrator):
metrics_collector = CharField(default="")
class Node(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "node"
......@@ -21,7 +22,7 @@ def migrate(migrator):
environment = ForeignKeyField(Environment, on_delete="RESTRICT")
class Pool(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "pool"
......@@ -29,7 +30,7 @@ def migrate(migrator):
name = CharField()
class Service(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "service"
......@@ -245,7 +246,7 @@ def migrate(migrator):
if 'logging' in conf:
del conf['logging']
conf["loglevel"] = srv.loglevel
srv.config = json.dumps(conf, sort_keys=True)
srv.config = json.dumps(conf.decode("utf-8"), sort_keys=True)
srv.save()
# noc service should be enabled if any noc services was enabled
for n in noc_promote_nodes:
......
from builtins import object
from peewee import CharField, Model
def migrate(migrator):
class Environment(Model):
class Meta:
class Meta(object):
database = migrator.db
db_table = "environment"
......
This diff is collapsed.
......@@ -8,6 +8,8 @@
# Third-party modules
from __future__ import absolute_import
from builtins import str
from builtins import object
from peewee import Model, CharField, TextField
# Tower modules
......@@ -15,7 +17,7 @@ from .db import db
class Datacenter(Model):
class Meta:
class Meta(object):
database = db
db_table = "datacenter"
......
This diff is collapsed.
......@@ -8,6 +8,7 @@
# Python modules
from __future__ import absolute_import
from builtins import object
import os
# Third-party modules
from peewee import (Model, CharField, TextField, ForeignKeyField,
......@@ -18,7 +19,7 @@ from .environment import Environment
class JobLog(Model):
class Meta:
class Meta(object):
database = db
db_table = "joblog"
......
......@@ -8,6 +8,7 @@
# Python modules
from __future__ import absolute_import
from builtins import object
import datetime
import logging
import os
......@@ -23,7 +24,7 @@ logger = logging.getLogger(__name__)
class Migration(Model):
class Meta:
class Meta(object):
database = db
db_table = "migration"
......
......@@ -8,6 +8,8 @@
# Third-party modules
from __future__ import absolute_import
from builtins import str
from builtins import object
from peewee import Model, CharField, TextField, ForeignKeyField, BooleanField
# Tower modules
from .db import db
......@@ -17,7 +19,7 @@ from .nodetype import NodeType
class Node(Model):
class Meta:
class Meta(object):
database = db
db_table = "node"
indexes = (
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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