From 3f95c7a4aaaf44e029d86ce2b7d46c1315e908e4 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 15 Nov 2012 19:00:33 -0500 Subject: don't explode if a 413 didn't set Retry-After We use 413 error code not only for temporary out of memory conditions but also for over quota issues. These kinds of requests don't set a Retry-After header, but the code assumed that was a valid key, thus exploding on a KeyError. Issue caught in looking at tempest traces. Fixes bug #1079387 Change-Id: Id406ab0799a35220b189b2e5292be092eb821ec5 --- nova/api/openstack/wsgi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index bfe0ec599..752e3fe70 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -1180,8 +1180,9 @@ class Fault(webob.exc.HTTPException): 'code': code, 'message': self.wrapped_exc.explanation}} if code == 413: - retry = self.wrapped_exc.headers['Retry-After'] - fault_data[fault_name]['retryAfter'] = retry + retry = self.wrapped_exc.headers.get('Retry-After', None) + if retry: + fault_data[fault_name]['retryAfter'] = retry # 'code' is an attribute on the fault tag itself metadata = {'attributes': {fault_name: 'code'}} -- cgit