From 6b8f1ae5a654d2e707fba2a24ab363801898517d Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Fri, 22 Apr 2016 10:42:34 +0530 Subject: [PATCH] Fix heat-keystone-setup-domain Change I4209f3bcc56467b6eb50a794694fe8d1da780161 to use oslo.log has broken the heat-keystone-setup-domain script. This patch fixes it. Change-Id: Ib98a453803d9fd2bf31056e8c9b49b84b2e7e715 Closes-Bug: #1573368 --- bin/heat-keystone-setup-domain | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/heat-keystone-setup-domain b/bin/heat-keystone-setup-domain index dc502fc519..f8ce074548 100755 --- a/bin/heat-keystone-setup-domain +++ b/bin/heat-keystone-setup-domain @@ -55,6 +55,18 @@ opts = [ ] +# Setup logging before registering additional options +logging.register_options(cfg.CONF) +extra_log_level_defaults = ['urllib3.connectionpool=WARNING'] +logging.set_defaults( + logging_context_format_string="%(levelname)s (%(module)s:" + "%(lineno)d) %(message)s", + default_log_levels=(logging.get_default_log_levels() + + extra_log_level_defaults)) +logging.setup(cfg.CONF, 'heat-keystone-setup-domain', + version.version_info.version_string()) + +# Register additional options cfg.CONF.register_cli_opts(opts) cfg.CONF(sys.argv[1:], project='heat', @@ -79,12 +91,6 @@ insecure = cfg.CONF.insecure def main(): - log_lvl = logging.DEBUG if DEBUG else logging.WARNING - logging.basicConfig( - format="%(levelname)s (%(module)s:%(lineno)d) %(message)s", - level=log_lvl) - logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING) - client_kwargs = { 'debug': DEBUG, 'username': USERNAME,