]> xenbits.xensource.com Git - osstest/openstack-nova.git/commitdiff
conf: remove deprecated exception option
authorMaciej Szankin <maciej.szankin@intel.com>
Tue, 15 Nov 2016 16:40:54 +0000 (10:40 -0600)
committerMaciej Szankin <maciej.szankin@intel.com>
Wed, 23 Nov 2016 15:25:03 +0000 (15:25 +0000)
Change-Id: Ia27d4040f317e5e70ac53341eccc80c868fe99e5
Implements: blueprint centralize-config-options-ocata

nova/conf/__init__.py
nova/conf/exceptions.py [deleted file]
nova/exception.py
nova/tests/unit/conf_fixture.py
nova/tests/unit/test_exception.py
releasenotes/notes/remove_deprecated_exception_conf_opt-94bfea599c2ebf5c.yaml [new file with mode: 0644]

index 82519b9ee432bfe11fcf9ec904a26884e8723775..e5337284b2cff6a5abf516a32d84a13c1b214563 100644 (file)
@@ -35,7 +35,6 @@ from nova.conf import consoleauth
 from nova.conf import crypto
 from nova.conf import database
 from nova.conf import ephemeral_storage
-from nova.conf import exceptions
 from nova.conf import flavors
 from nova.conf import floating_ips
 from nova.conf import glance
@@ -92,7 +91,6 @@ consoleauth.register_opts(CONF)
 crypto.register_opts(CONF)
 database.register_opts(CONF)
 ephemeral_storage.register_opts(CONF)
-exceptions.register_opts(CONF)
 floating_ips.register_opts(CONF)
 flavors.register_opts(CONF)
 glance.register_opts(CONF)
diff --git a/nova/conf/exceptions.py b/nova/conf/exceptions.py
deleted file mode 100644 (file)
index a5384a2..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2016 OpenStack Foundation
-# All Rights Reserved.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-
-from oslo_config import cfg
-
-exc_log_opts = [
-    cfg.BoolOpt('fatal_exception_format_errors',
-                default=False,
-                deprecated_for_removal=True,
-                deprecated_since="14.0.0",
-                deprecated_reason="This is only used for internal testing.",
-                help="""
-When set to true, this option enables validation of exception
-message format.
-
-This option is used to detect errors in NovaException class when it formats
-error messages. If True, raise an exception; if False, use the unformatted
-message.
-""")
-]
-
-
-def register_opts(conf):
-    conf.register_opts(exc_log_opts)
-
-
-def list_opts():
-    return {'DEFAULT': exc_log_opts}
index d50b259a117a5bc71d71cd6c5b465fec299c9e83..e28ee98fd4bd593659a9be9401336fcab986006c 100644 (file)
@@ -22,8 +22,6 @@ SHOULD include dedicated exception logging.
 
 """
 
-import sys
-
 from oslo_log import log as logging
 import six
 import webob.exc
@@ -88,18 +86,13 @@ class NovaException(Exception):
                 message = self.msg_fmt % kwargs
 
             except Exception:
-                exc_info = sys.exc_info()
                 # kwargs doesn't match a variable in the message
                 # log the issue and the kwargs
                 LOG.exception(_LE('Exception in string format operation'))
                 for name, value in six.iteritems(kwargs):
                     LOG.error("%s: %s" % (name, value))  # noqa
 
-                if CONF.fatal_exception_format_errors:
-                    six.reraise(*exc_info)
-                else:
-                    # at least get the core message out if something happened
-                    message = self.msg_fmt
+                message = self.msg_fmt
 
         self.message = message
         super(NovaException, self).__init__(message)
index 981f1370530ae5cfbbd53cf45b21e560a62c8173..5b6269aa0a6a38608945939bc9530110a7f3ca91 100644 (file)
@@ -54,7 +54,6 @@ class ConfFixture(config_fixture.Config):
         self.conf.set_default('sqlite_synchronous', False, group='database')
         self.conf.set_default('sqlite_synchronous', False,
                 group='api_database')
-        self.conf.set_default('fatal_exception_format_errors', True)
         # TODO(sdague): this makes our project_id match 'fake' as well.
         # We should fix the tests to use real
         # UUIDs then drop this work around.
index b4ff568e15535b4180b55b2123040a5080855425..07f99ed1d7a1968c7cdf5318d05bd91954a45abe 100644 (file)
@@ -188,7 +188,6 @@ class NovaExceptionTestCase(test.NoDBTestCase):
             def __unicode__(self):
                 return u"print the whole trace"
 
-        self.flags(fatal_exception_format_errors=False)
         exc = FakeNovaException_Remote(lame_arg='lame')
         self.assertEqual("some message %(somearg)s", exc.format_message())
 
@@ -219,7 +218,6 @@ class ExceptionTestCase(test.NoDBTestCase):
 
     def test_exceptions_raise(self):
         # NOTE(dprince): disable format errors since we are not passing kwargs
-        self.flags(fatal_exception_format_errors=False)
         for name in dir(exception):
             exc = getattr(exception, name)
             if isinstance(exc, type):
diff --git a/releasenotes/notes/remove_deprecated_exception_conf_opt-94bfea599c2ebf5c.yaml b/releasenotes/notes/remove_deprecated_exception_conf_opt-94bfea599c2ebf5c.yaml
new file mode 100644 (file)
index 0000000..b91521e
--- /dev/null
@@ -0,0 +1,5 @@
+---
+upgrade:
+  - |
+    ``fatal_exception_format_errors`` configuration option has been removed,
+    as it was only used for internal testing.
\ No newline at end of file