conf: remove deprecated exception option

Change-Id: Ia27d4040f317e5e70ac53341eccc80c868fe99e5
Implements: blueprint centralize-config-options-ocata
This commit is contained in:
Maciej Szankin 2016-11-15 10:40:54 -06:00
parent 80306af88b
commit 4bac18b28c
6 changed files with 6 additions and 53 deletions

View 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)

View File

@ -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}

View 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)

View 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.

View 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):

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
``fatal_exception_format_errors`` configuration option has been removed,
as it was only used for internal testing.