From ff8f03ece53c96893a487e87b29ded09e220699d Mon Sep 17 00:00:00 2001 From: Masayuki Igawa Date: Fri, 3 Feb 2017 16:22:11 +0900 Subject: [PATCH] Fix coverage2sql-db-manage to read config This commit fixes coverage2sql-db-manage to read config file correctly. In the previous version, coverage2sql-db-manage command doesn't work. I'm not sure when it didn't work, though. Change-Id: If3bb93a661a723b0ff0eedf9f0ed84c2af8d88e6 --- coverage2sql/db/api.py | 3 ++- coverage2sql/migrations/cli.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/coverage2sql/db/api.py b/coverage2sql/db/api.py index 941e66a..001127e 100644 --- a/coverage2sql/db/api.py +++ b/coverage2sql/db/api.py @@ -38,7 +38,8 @@ def setup(): pool_size = CONF.database.max_pool_size pool_recycle = CONF.database.idle_timeout - if not pool_size and not pool_recycle: + if db_uri.get_backend_name() == 'sqlite' or (not pool_size + and not pool_recycle): engine = create_engine(db_uri) else: engine = create_engine(db_uri, diff --git a/coverage2sql/migrations/cli.py b/coverage2sql/migrations/cli.py index f4a0a33..cd5ed5e 100644 --- a/coverage2sql/migrations/cli.py +++ b/coverage2sql/migrations/cli.py @@ -23,6 +23,7 @@ from alembic import util as alembic_util from oslo_config import cfg from coverage2sql.db import api as db_api +from coverage2sql import shell HEAD_FILENAME = 'HEAD' @@ -177,7 +178,9 @@ def main(): config.set_main_option('script_location', 'coverage2sql:migrations') config.coverage2sql_config = CONF + CONF.register_cli_opts(shell.DATABASE_OPTS, group='database') CONF() + db_api.get_session() CONF.command.func(config, CONF.command.name) if __name__ == "__main__":