summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-08-09 22:16:33 -0400
committerDan Prince <dprince@redhat.com>2012-08-09 22:25:26 -0400
commit7219577ba48df211713cab655cdd296a07f35773 (patch)
treecc278304fd159f8e24be834f0d7b183ac442125d /nova/api
parent043e3f5981d89d35aa8bb8f1c42561c38451dfc4 (diff)
Make FaultWrapper handle exception code = None.
Updates the FaultWrapper middleware so that it properly handles exceptions which contain a code variable set to None. Previously you'd get TypeError exception like this in the api.log file: TypeError: %d format: a number is required, not NoneType This was due to the fact that we tried to format a string with an integer value which was set to None. I hit this today when using Qpid which does in fact throw exceptions which contain 'code' variables set to None. Fixes LP Bug #1035159. Change-Id: I7193031b1f5f9bf84cdb476f8f1268efc50eadf0
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py
index 6baa6be91..12dd8ae83 100644
--- a/nova/api/openstack/__init__.py
+++ b/nova/api/openstack/__init__.py
@@ -52,6 +52,8 @@ class FaultWrapper(base_wsgi.Middleware):
safe = getattr(inner, 'safe', False)
headers = getattr(inner, 'headers', None)
status = getattr(inner, 'code', 500)
+ if status is None:
+ status = 500
msg_dict = dict(url=req.url, status=status)
LOG.info(_("%(url)s returned with HTTP %(status)d") % msg_dict)