Exemple #1
0
 def run(self):
     print(vars(threading.local()))
     s = SimpleTable()
     s.col_1 = self.string
     dbsession.add(s)
     sleep(self.sleep)
     if self.commit:
         dbsession.commit()
     else:
         dbsession.rollback()
Exemple #2
0
 def run(self):
     print(vars(threading.local()))
     s = SimpleTable()
     s.col_1 = self.string
     dbsession.add(s)
     sleep(self.sleep)
     if self.commit:
         dbsession.commit()
     else:
         dbsession.rollback()
Exemple #3
0
 def create_port(self, user, sgid=None):
     port = PortDatabase()
     port.user_id = user
     if sgid is not None:
         port.service_group_id = sgid
     else:
         port.service_group_id = self.sg.id
     port.port = 5678
     port.save()
     dbsession.commit()
     return port
Exemple #4
0
 def create_port(self, user, sgid = None):
     port = PortDatabase()
     port.user_id = user
     if sgid is not None:
         port.service_group_id = sgid
     else:
         port.service_group_id = self.sg.id
     port.port = 5678
     port.save()
     dbsession.commit()
     return port
Exemple #5
0
 def create_repository(self, user, name, type, sgid=None):
     repo = RepositoryDatabase()
     repo.user_id = user
     if sgid is not None:
         repo.service_group_id = sgid
     else:
         repo.service_group_id = self.sg.id
     repo.name = name
     repo.type = type
     repo.save()
     dbsession.commit()
     return repo
Exemple #6
0
 def create_repository(self, user, name, type, sgid = None):
     repo = RepositoryDatabase()
     repo.user_id = user
     if sgid is not None:
         repo.service_group_id = sgid
     else:
         repo.service_group_id = self.sg.id
     repo.name = name
     repo.type = type
     repo.save()
     dbsession.commit()
     return repo
Exemple #7
0
    def setUp(self):
        super(TestRepositoriesRoutine, self).setUp()

        hilla = ServerDatabase()
        hilla.name = 'Hilla'
        hilla.save()
        dbsession.commit()

        lakka = ServerDatabase()
        lakka.name = 'Lakka'
        lakka.save()
        dbsession.commit()

        hilla_ports = ServiceGroupDatabase()
        hilla_ports.name = 'Hilla_ports'
        hilla_ports.type = 'port'
        hilla_ports.save()
        dbsession.commit()

        lakka_ports = ServiceGroupDatabase()
        lakka_ports.name = 'Lakka_ports'
        lakka_ports.type = 'port'
        lakka_ports.save()
        dbsession.commit()

        hilla_port = ServiceDatabase()
        hilla_port.name = 'Hilla_port'
        hilla_port.service_group = hilla_ports
        hilla_port.server = hilla
        hilla_port.save()
        dbsession.commit()

        lakka_port = ServiceDatabase()
        lakka_port.name = 'Lakka_port'
        lakka_port.service_group = lakka_ports
        lakka_port.server = hilla
        lakka_port.save()
        dbsession.commit()

        self.sg = hilla_ports
        self.sg2 = lakka_ports
Exemple #8
0
    def setUp(self):
        super(TestRepositoriesRoutine, self).setUp()

        hilla = ServerDatabase()
        hilla.name = 'Hilla'
        hilla.save()
        dbsession.commit()

        lakka = ServerDatabase()
        lakka.name = 'Lakka'
        lakka.save()
        dbsession.commit()

        hilla_ports = ServiceGroupDatabase()
        hilla_ports.name = 'Hilla_ports'
        hilla_ports.type = 'port'
        hilla_ports.save()
        dbsession.commit()

        lakka_ports = ServiceGroupDatabase()
        lakka_ports.name = 'Lakka_ports'
        lakka_ports.type = 'port'
        lakka_ports.save()
        dbsession.commit()

        hilla_port = ServiceDatabase()
        hilla_port.name = 'Hilla_port'
        hilla_port.service_group = hilla_ports
        hilla_port.server = hilla
        hilla_port.save()
        dbsession.commit()

        lakka_port = ServiceDatabase()
        lakka_port.name = 'Lakka_port'
        lakka_port.service_group = lakka_ports
        lakka_port.server = hilla
        lakka_port.save()
        dbsession.commit()

        self.sg = hilla_ports
        self.sg2 = lakka_ports
Exemple #9
0
def setup_development_servers():
    """
    Add lakka and hilla servers and create couple services and service groups
    """
    if not ServerDatabase.query().filter(ServerDatabase.name == 'Hilla').all():
        hilla = ServerDatabase()
        hilla.name = 'Hilla'
        hilla.save()
    else:
        hilla = ServerDatabase.query().filter(ServerDatabase.name == 'Hilla').one()

    if not ServerDatabase.query().filter(ServerDatabase.name == 'Lakka').all():
        lakka = ServerDatabase()
        lakka.name = 'Lakka'
        lakka.save()
    else:
        lakka = ServerDatabase.query().filter(ServerDatabase.name == 'Lakka').one()

    if not ServerDatabase.query().filter(ServerDatabase.name == 'db1').all():
        db1 = ServerDatabase()
        db1.name = 'db1'
        db1.save()
    else:
        db1 = ServerDatabase.query().filter(ServerDatabase.name == 'db1').one()

    if not ServerDatabase.query().filter(ServerDatabase.name == 'db2').all():
        db2 = ServerDatabase()
        db2.name = 'db2'
        db2.save()
    else:
        db2 = ServerDatabase.query().filter(ServerDatabase.name == 'db2').one()

    if not ServiceGroupDatabase.query().filter(ServiceGroupDatabase.name == 'Hilla_ports').all():
        hilla_ports = ServiceGroupDatabase()
        hilla_ports.name = 'Hilla_ports'
        hilla_ports.type = 'port'
        hilla_ports.save()
    else:
        hilla_ports = ServiceGroupDatabase.query().filter(ServiceGroupDatabase.name == 'Hilla_ports').one()

    if not ServiceGroupDatabase.query().filter(ServiceGroupDatabase.name == 'Lakka_ports').all():
        lakka_ports = ServiceGroupDatabase()
        lakka_ports.name = 'Lakka_ports'
        lakka_ports.type = 'port'
        lakka_ports.save()
    else:
        lakka_ports = ServiceGroupDatabase.query().filter(ServiceGroupDatabase.name == 'Lakka_ports').one()

    if not ServiceGroupDatabase.query().filter(ServiceGroupDatabase.name == 'Mysql_databases').all():
        mysql_databases = ServiceGroupDatabase()
        mysql_databases.name = 'Mysql_databases'
        mysql_databases.type = 'mysql_database'
        mysql_databases.save()
    else:
        mysql_databases = ServiceGroupDatabase.query().filter(ServiceGroupDatabase.name == 'Mysql_databases').one()

    if not ServiceGroupDatabase.query().filter(ServiceGroupDatabase.name == 'Psql_databases').all():
        psql_databases = ServiceGroupDatabase()
        psql_databases.name = 'Psql_databases'
        psql_databases.type = 'Psql_database'
        psql_databases.save()
    else:
        psql_databases = ServiceGroupDatabase.query().filter(ServiceGroupDatabase.name == 'Psql_databases').one()

    dbsession.flush()

    if not ServiceDatabase.query().filter(ServiceDatabase.name == 'Mysql_database').all():
        mysql_database = ServiceDatabase()
        mysql_database.name = 'Mysql_Database'
        mysql_database.service_group = mysql_databases
        mysql_database.server = hilla
        mysql_database.save()
    else:
        mysql_database = ServiceDatabase.query().filter(ServiceDatabase.name == 'Mysql_database').one()

    if not ServiceDatabase.query().filter(ServiceDatabase.name == 'Psql_database').all():
        psql_database = ServiceDatabase()
        psql_database.name = 'Psql_database'
        psql_database.service_group = psql_databases
        psql_database.server = hilla
        psql_database.save()
    else:
        psql_database = ServiceDatabase.query().filter(ServiceDatabase.name == 'Psql_database').one()

    if not ServiceDatabase.query().filter(ServiceDatabase.name == 'Hilla_port').all():
        hilla_port = ServiceDatabase()
        hilla_port.name = 'Hilla_port'
        hilla_port.service_group = hilla_ports
        hilla_port.server = hilla
        hilla_port.save()
    else:
        hilla_port = ServiceDatabase.query().filter(ServiceDatabase.name == 'Hilla_port').one()

    if not ServiceDatabase.query().filter(ServiceDatabase.name == 'Lakka_port').all():
        lakka_port = ServiceDatabase()
        lakka_port.name = 'Lakka_port'
        lakka_port.service_group = lakka_ports
        lakka_port.server = hilla
        lakka_port.save()
    else:
        lakka_port = ServiceDatabase.query().filter(ServiceDatabase.name == 'Lakka_port').one()
    dbsession.commit()
Exemple #10
0
def setup_development_servers():
    """
    Add lakka and hilla servers and create couple services and service groups
    """
    if not ServerDatabase.query().filter(ServerDatabase.name == 'Hilla').all():
        hilla = ServerDatabase()
        hilla.name = 'Hilla'
        hilla.save()
    else:
        hilla = ServerDatabase.query().filter(
            ServerDatabase.name == 'Hilla').one()

    if not ServerDatabase.query().filter(ServerDatabase.name == 'Lakka').all():
        lakka = ServerDatabase()
        lakka.name = 'Lakka'
        lakka.save()
    else:
        lakka = ServerDatabase.query().filter(
            ServerDatabase.name == 'Lakka').one()

    if not ServerDatabase.query().filter(ServerDatabase.name == 'db1').all():
        db1 = ServerDatabase()
        db1.name = 'db1'
        db1.save()
    else:
        db1 = ServerDatabase.query().filter(ServerDatabase.name == 'db1').one()

    if not ServerDatabase.query().filter(ServerDatabase.name == 'db2').all():
        db2 = ServerDatabase()
        db2.name = 'db2'
        db2.save()
    else:
        db2 = ServerDatabase.query().filter(ServerDatabase.name == 'db2').one()

    if not ServiceGroupDatabase.query().filter(
            ServiceGroupDatabase.name == 'Hilla_ports').all():
        hilla_ports = ServiceGroupDatabase()
        hilla_ports.name = 'Hilla_ports'
        hilla_ports.type = 'port'
        hilla_ports.save()
    else:
        hilla_ports = ServiceGroupDatabase.query().filter(
            ServiceGroupDatabase.name == 'Hilla_ports').one()

    if not ServiceGroupDatabase.query().filter(
            ServiceGroupDatabase.name == 'Lakka_ports').all():
        lakka_ports = ServiceGroupDatabase()
        lakka_ports.name = 'Lakka_ports'
        lakka_ports.type = 'port'
        lakka_ports.save()
    else:
        lakka_ports = ServiceGroupDatabase.query().filter(
            ServiceGroupDatabase.name == 'Lakka_ports').one()

    if not ServiceGroupDatabase.query().filter(
            ServiceGroupDatabase.name == 'Mysql_databases').all():
        mysql_databases = ServiceGroupDatabase()
        mysql_databases.name = 'Mysql_databases'
        mysql_databases.type = 'mysql_database'
        mysql_databases.save()
    else:
        mysql_databases = ServiceGroupDatabase.query().filter(
            ServiceGroupDatabase.name == 'Mysql_databases').one()

    if not ServiceGroupDatabase.query().filter(
            ServiceGroupDatabase.name == 'Psql_databases').all():
        psql_databases = ServiceGroupDatabase()
        psql_databases.name = 'Psql_databases'
        psql_databases.type = 'Psql_database'
        psql_databases.save()
    else:
        psql_databases = ServiceGroupDatabase.query().filter(
            ServiceGroupDatabase.name == 'Psql_databases').one()

    dbsession.flush()

    if not ServiceDatabase.query().filter(
            ServiceDatabase.name == 'Mysql_database').all():
        mysql_database = ServiceDatabase()
        mysql_database.name = 'Mysql_Database'
        mysql_database.service_group = mysql_databases
        mysql_database.server = hilla
        mysql_database.save()
    else:
        mysql_database = ServiceDatabase.query().filter(
            ServiceDatabase.name == 'Mysql_database').one()

    if not ServiceDatabase.query().filter(
            ServiceDatabase.name == 'Psql_database').all():
        psql_database = ServiceDatabase()
        psql_database.name = 'Psql_database'
        psql_database.service_group = psql_databases
        psql_database.server = hilla
        psql_database.save()
    else:
        psql_database = ServiceDatabase.query().filter(
            ServiceDatabase.name == 'Psql_database').one()

    if not ServiceDatabase.query().filter(
            ServiceDatabase.name == 'Hilla_port').all():
        hilla_port = ServiceDatabase()
        hilla_port.name = 'Hilla_port'
        hilla_port.service_group = hilla_ports
        hilla_port.server = hilla
        hilla_port.save()
    else:
        hilla_port = ServiceDatabase.query().filter(
            ServiceDatabase.name == 'Hilla_port').one()

    if not ServiceDatabase.query().filter(
            ServiceDatabase.name == 'Lakka_port').all():
        lakka_port = ServiceDatabase()
        lakka_port.name = 'Lakka_port'
        lakka_port.service_group = lakka_ports
        lakka_port.server = hilla
        lakka_port.save()
    else:
        lakka_port = ServiceDatabase.query().filter(
            ServiceDatabase.name == 'Lakka_port').one()
    dbsession.commit()