diff options
| author | Sean Dague <sdague@linux.vnet.ibm.com> | 2012-11-15 19:00:33 -0500 |
|---|---|---|
| committer | Sean Dague <sdague@linux.vnet.ibm.com> | 2012-11-15 19:00:33 -0500 |
| commit | 3f95c7a4aaaf44e029d86ce2b7d46c1315e908e4 (patch) | |
| tree | 3bdbdd9c4159448f244ca559faad008e5b0d4619 | |
| parent | 26d92b591df528e7c67fd9353ff19acce2b3b62a (diff) | |
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
| -rw-r--r-- | nova/api/openstack/wsgi.py | 5 |
1 files 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'}} |
