def main(): cfg.CONF.register_cli_opt(command_opt) try: cfg.CONF(sys.argv[1:], project='koala', prog='koala-manage') log.setup('koala') except RuntimeError as e: sys.exit("ERROR: %s" % e) version = None or sys.argv[2] try: migration.db_sync(version=version) except RuntimeError as e: sys.exit("ERROR: %s" % e)
from koala.common import paths from koala.db import migration from koala.openstack.common.db.sqlalchemy import session from koala.openstack.common import log as logging from koala.tests import conf_fixture test_opts = [cfg.StrOpt("sqlite_clean_db", default="clean.sqlite", help="File name of clean sqlite db")] CONF = cfg.CONF CONF.register_opts(test_opts) CONF.import_opt("connection", "koala.openstack.common.db.sqlalchemy.session", group="database") CONF.import_opt("sqlite_db", "koala.openstack.common.db.sqlalchemy.session") logging.setup("koala") _DB_CACHE = None class Database(fixtures.Fixture): def __init__(self, db_session, db_migrate, sql_connection, sqlite_db, sqlite_clean_db): self.sql_connection = sql_connection self.sqlite_db = sqlite_db self.sqlite_clean_db = sqlite_clean_db self.engine = db_session.get_engine() self.engine.dispose() conn = self.engine.connect() if sql_connection == "sqlite://": if db_migrate.db_version() > db_migrate.INIT_VERSION:
def prepare_service(argv=[]): cfg.CONF(argv[1:], project='koala') log.setup('koala')
test_opts = [ cfg.StrOpt('sqlite_clean_db', default='clean.sqlite', help='File name of clean sqlite db'), ] CONF = cfg.CONF CONF.register_opts(test_opts) CONF.import_opt('connection', 'koala.openstack.common.db.sqlalchemy.session', group='database') CONF.import_opt('sqlite_db', 'koala.openstack.common.db.sqlalchemy.session') logging.setup('koala') _DB_CACHE = None class Database(fixtures.Fixture): def __init__(self, db_session, db_migrate, sql_connection, sqlite_db, sqlite_clean_db): self.sql_connection = sql_connection self.sqlite_db = sqlite_db self.sqlite_clean_db = sqlite_clean_db self.engine = db_session.get_engine() self.engine.dispose() conn = self.engine.connect()