From 6d5ebc088ece60b745f11d5c0b37ae8ef8957b9d Mon Sep 17 00:00:00 2001 From: Baohua Yang Date: Tue, 5 Jan 2016 01:26:09 -0600 Subject: [PATCH] Add debug flag in the config 1) Let server read the debug flag from config 2) Write the test case, use assertEqual for explicity 3) Keep the value to True for current usage Change-Id: I83e4ae92e43b8be92cf92ff257f317ed1bf9491e Closes-Bug: #1531073 --- kuryr/common/config.py | 4 +++- kuryr/server.py | 2 +- kuryr/tests/unit/test_config.py | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kuryr/common/config.py b/kuryr/common/config.py index 0d6ca14d..3d8c15ea 100644 --- a/kuryr/common/config.py +++ b/kuryr/common/config.py @@ -46,7 +46,9 @@ core_opts = [ help=_('The default neutron local address-scope name')), cfg.StrOpt('global_default_address_space', default='global_scope', - help=_('The default neutron global address-scope name.')) + help=_('The default neutron global address-scope name.')), + cfg.BoolOpt('debug', default=True, + help=_('Enable or Disable debug mode for kuryr server.')) ] neutron_opts = [ cfg.StrOpt('neutron_uri', diff --git a/kuryr/server.py b/kuryr/server.py index 278853a8..91a05acc 100644 --- a/kuryr/server.py +++ b/kuryr/server.py @@ -21,5 +21,5 @@ def start(): from kuryr import app from kuryr import controllers controllers.check_for_neutron_ext_support() - app.debug = True + app.debug = config.CONF.debug app.run("0.0.0.0", port) diff --git a/kuryr/tests/unit/test_config.py b/kuryr/tests/unit/test_config.py index 8a99b021..04605403 100644 --- a/kuryr/tests/unit/test_config.py +++ b/kuryr/tests/unit/test_config.py @@ -32,6 +32,8 @@ class ConfigurationTest(base.TestKuryrBase): self.assertEqual('http://127.0.0.1:2377', config.CONF.kuryr_uri) + self.assertEqual(True, config.CONF.debug) + self.assertEqual('http://127.0.0.1:9696', config.CONF.neutron_client.neutron_uri)