Remove inner_exceptions plumbing
We've finally gotten out of the business of wrapping exceptions. Since we don't do that anymore, we don't need the log_inner_exceptions logic. Change-Id: Id1f709daa2e61c13efeeeffc2a08578c27265e56
This commit is contained in:
parent
d3dd191988
commit
655c4ce9e2
@ -52,11 +52,6 @@ shade.request_ids
|
||||
This can be be useful for tracking action taken on the server-side if one
|
||||
does not want `HTTP Tracing`_.
|
||||
|
||||
shade.exc
|
||||
If `log_inner_exceptions` is set to True, `shade` will emit any wrapped
|
||||
exception to the `shade.exc` logger. Wrapped exceptions are usually
|
||||
considered implementation details, but can be useful for debugging problems.
|
||||
|
||||
shade.iterate_timeout
|
||||
When `shade` needs to poll a resource, it does so in a loop that waits
|
||||
between iterations and ultimately timesout. The `shade.iterate_timeout`
|
||||
|
21
shade/exc.py
21
shade/exc.py
@ -32,26 +32,15 @@ class OpenStackCloudException(Exception):
|
||||
args.append("Extra: {0}".format(str(extra_data)))
|
||||
super(OpenStackCloudException, self).__init__(*args, **kwargs)
|
||||
self.extra_data = extra_data
|
||||
# NOTE(mordred) The next two are not used for anything, but
|
||||
# they are public attributes so we keep them around.
|
||||
self.inner_exception = sys.exc_info()
|
||||
self.orig_message = message
|
||||
|
||||
def log_error(self, logger=None):
|
||||
if not logger:
|
||||
logger = _log.setup_logging('shade.exc')
|
||||
if self.inner_exception and self.inner_exception[1]:
|
||||
logger.error(self.orig_message, exc_info=self.inner_exception)
|
||||
|
||||
def __str__(self):
|
||||
message = Exception.__str__(self)
|
||||
if (self.inner_exception and self.inner_exception[1]
|
||||
and not self.orig_message.endswith(
|
||||
str(self.inner_exception[1]))):
|
||||
message = "%s (Inner Exception: %s)" % (
|
||||
message,
|
||||
str(self.inner_exception[1]))
|
||||
if self.log_inner_exceptions:
|
||||
self.log_error()
|
||||
return message
|
||||
# NOTE(mordred) This method is here for backwards compat. As shade
|
||||
# no longer wraps any exceptions, this doesn't do anything.
|
||||
pass
|
||||
|
||||
|
||||
class OpenStackCloudCreateException(OpenStackCloudException):
|
||||
|
@ -114,15 +114,7 @@ class OpenStackCloud(
|
||||
OpenStack API tasks. Unless you're doing
|
||||
rate limiting client side, you almost
|
||||
certainly don't need this. (optional)
|
||||
:param bool log_inner_exceptions: Send wrapped exceptions to the error log.
|
||||
Defaults to false, because there are a
|
||||
number of wrapped exceptions that are
|
||||
noise for normal usage. It's possible
|
||||
that for a user that has python logging
|
||||
configured properly, it's desirable to
|
||||
have all of the wrapped exceptions be
|
||||
emitted to the error log. This flag
|
||||
will enable that behavior.
|
||||
:param bool log_inner_exceptions: Ignored. Exists for backwards compat.
|
||||
:param bool strict: Only return documented attributes for each resource
|
||||
as per the shade Data Model contract. (Default False)
|
||||
:param app_name: Name of the application to be appended to the user-agent
|
||||
@ -145,9 +137,6 @@ class OpenStackCloud(
|
||||
use_direct_get=False,
|
||||
**kwargs):
|
||||
|
||||
if log_inner_exceptions:
|
||||
OpenStackCloudException.log_inner_exceptions = True
|
||||
|
||||
self.log = _log.setup_logging('shade')
|
||||
|
||||
if not cloud_config:
|
||||
|
@ -37,15 +37,13 @@ class BaseFunctionalTestCase(base.TestCase):
|
||||
user_config = self.config.get_one_cloud(
|
||||
cloud=self._demo_name, **kwargs)
|
||||
self.user_cloud = shade.OpenStackCloud(
|
||||
cloud_config=user_config,
|
||||
log_inner_exceptions=True)
|
||||
cloud_config=user_config)
|
||||
|
||||
def _set_operator_cloud(self, **kwargs):
|
||||
operator_config = self.config.get_one_cloud(
|
||||
cloud=self._op_name, **kwargs)
|
||||
self.operator_cloud = shade.OperatorCloud(
|
||||
cloud_config=operator_config,
|
||||
log_inner_exceptions=True)
|
||||
cloud_config=operator_config)
|
||||
|
||||
def pick_image(self):
|
||||
images = self.user_cloud.list_images()
|
||||
|
@ -126,15 +126,12 @@ class BaseTestCase(base.TestCase):
|
||||
self.cloud_config = self.config.get_one_cloud(
|
||||
cloud=test_cloud, validate=False)
|
||||
self.cloud = shade.OpenStackCloud(
|
||||
cloud_config=self.cloud_config,
|
||||
log_inner_exceptions=True)
|
||||
cloud_config=self.cloud_config)
|
||||
self.strict_cloud = shade.OpenStackCloud(
|
||||
cloud_config=self.cloud_config,
|
||||
log_inner_exceptions=True,
|
||||
strict=True)
|
||||
self.op_cloud = shade.OperatorCloud(
|
||||
cloud_config=self.cloud_config,
|
||||
log_inner_exceptions=True)
|
||||
cloud_config=self.cloud_config)
|
||||
|
||||
|
||||
class TestCase(BaseTestCase):
|
||||
@ -451,11 +448,9 @@ class RequestsMockTestCase(BaseTestCase):
|
||||
self.cloud_config = self.config.get_one_cloud(
|
||||
cloud=test_cloud, validate=True, **kwargs)
|
||||
self.cloud = shade.OpenStackCloud(
|
||||
cloud_config=self.cloud_config,
|
||||
log_inner_exceptions=True)
|
||||
cloud_config=self.cloud_config)
|
||||
self.op_cloud = shade.OperatorCloud(
|
||||
cloud_config=self.cloud_config,
|
||||
log_inner_exceptions=True)
|
||||
cloud_config=self.cloud_config)
|
||||
|
||||
def get_glance_discovery_mock_dict(
|
||||
self,
|
||||
|
Loading…
x
Reference in New Issue
Block a user