Merge "Fix verbose option inialization"

This commit is contained in:
Jenkins 2015-09-25 19:51:50 +00:00 committed by Gerrit Code Review
commit be5a896e1b
4 changed files with 7 additions and 7 deletions
subunit2sql
analysis
db
migrations
shell.py

@ -27,6 +27,7 @@ import subunit2sql.analysis.run_time
from subunit2sql import shell
CONF = cfg.CONF
CONF.import_opt('verbose', 'subunit2sql.db.api')
SHELL_OPTS = [
cfg.StrOpt('title', short='t', help='Optional title to use for the graph '
@ -41,8 +42,6 @@ SHELL_OPTS = [
cfg.StrOpt('stop-date', short='s',
help='Stop date for the graph only data from before this date '
'will be used. Uses ISO 8601 format: 1914-06-28'),
cfg.BoolOpt('verbose', short='v',
help='Verbose output including logging of SQL statements'),
]

@ -28,6 +28,9 @@ from subunit2sql import exceptions
from subunit2sql import read_subunit
CONF = cfg.CONF
CONF.register_cli_opt(cfg.BoolOpt('verbose', short='v', default=False,
help='Verbose output including logging of '
'SQL statements'))
DAY_SECONDS = 60 * 60 * 24
@ -60,7 +63,7 @@ def get_session(autocommit=True, expire_on_commit=False):
# if --verbose was specified, turn on SQL logging
# note that this is done after the session has been initialized so that
# we can override the default sqlalchemy logging
if CONF.verbose:
if CONF.get('verbose', False):
logging.basicConfig()
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)

@ -41,13 +41,12 @@ MIGRATION_OPTS = [
"out the microseconds from the timestamps this will skip "
"converting the microsecond field from the timestamps "
"into a separate column"),
cfg.BoolOpt('verbose', short='v',
help='Verbose output including logging of SQL statements'),
]
CONF = cfg.CONF
CONF.register_cli_opts(options.database_opts, group='database')
CONF.register_cli_opts(MIGRATION_OPTS)
CONF.import_opt('verbose', 'subunit2sql.db.api')
def do_alembic_command(config, cmd, *args, **kwargs):

@ -25,6 +25,7 @@ from subunit2sql import exceptions
from subunit2sql import read_subunit as subunit
CONF = cfg.CONF
CONF.import_opt('verbose', 'subunit2sql.db.api')
SHELL_OPTS = [
cfg.MultiStrOpt('subunit_files', positional=True,
@ -41,8 +42,6 @@ SHELL_OPTS = [
cfg.StrOpt('attr_regex', default='\[(.*)\]',
help='The regex to use to extract the comma separated list of '
'test attributes from the test_id'),
cfg.BoolOpt('verbose', short='v',
help='Verbose output including logging of SQL statements'),
]
_version_ = version.VersionInfo('subunit2sql').version_string()