Esempio n. 1
0
 def _configure(self, engine):
     """For each type of repository we should do some of configure steps.
     For migrate_repo we should set under version control our database.
     For alembic we should configure database settings. For this goal we
     should use oslo.config and openstack.commom.db.sqlalchemy.session with
     database functionality (reset default settings and session cleanup).
     """
     CONF.set_override('connection', str(engine.url), group='database')
     session.cleanup()
Esempio n. 2
0
 def _configure(self, engine):
     """For each type of repository we should do some of configure steps.
     For migrate_repo we should set under version control our database.
     For alembic we should configure database settings. For this goal we
     should use oslo.config and openstack.commom.db.sqlalchemy.session with
     database functionality (reset default settings and session cleanup).
     """
     CONF.set_override('connection', str(engine.url), group='database')
     session.cleanup()
Esempio n. 3
0
 def _alembic_command(self, alembic_command, engine, *args, **kwargs):
     """Most of alembic command return data into output.
     We should redefine this setting for getting info.
     """
     self.ALEMBIC_CONFIG.stdout = buf = io.StringIO()
     CONF.set_override('connection', str(engine.url), group='database')
     session.cleanup()
     getattr(command, alembic_command)(*args, **kwargs)
     res = buf.getvalue().strip()
     LOG.debug('Alembic command `%s` returns: %s' % (alembic_command, res))
     session.cleanup()
     return res
Esempio n. 4
0
 def _alembic_command(self, alembic_command, engine, *args, **kwargs):
     """Most of alembic command return data into output.
     We should redefine this setting for getting info.
     """
     self.ALEMBIC_CONFIG.stdout = buf = io.StringIO()
     CONF.set_override('connection', str(engine.url), group='database')
     session.cleanup()
     getattr(command, alembic_command)(*args, **kwargs)
     res = buf.getvalue().strip()
     LOG.debug('Alembic command `%s` returns: %s' % (alembic_command, res))
     session.cleanup()
     return res
Esempio n. 5
0
def clear_db(base=model_base.SavannaBase):
    global _DB_ENGINE
    unregister_models(base)
    session.cleanup()
    _DB_ENGINE = None