Exemple #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()
 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()
Exemple #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
 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