diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-05-31 14:49:47 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-05-31 14:49:47 -0700 |
| commit | b0c43e57ad6a7e5be8a749e70da39b7f7ba547bd (patch) | |
| tree | 6d2e5a65254a941ebf083c2e655e4db701b0667f | |
| parent | 38ba122d9eb67c699ea0c10eab5961c3b4c25d81 (diff) | |
switch to using webob exception
| -rw-r--r-- | nova/api/ec2/metadatarequesthandler.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/nova/api/ec2/metadatarequesthandler.py b/nova/api/ec2/metadatarequesthandler.py index 720f264a4..9c8e52270 100644 --- a/nova/api/ec2/metadatarequesthandler.py +++ b/nova/api/ec2/metadatarequesthandler.py @@ -76,12 +76,10 @@ class MetadataRequestHandler(wsgi.Application): meta_data = cc.get_metadata(remote_address) except Exception: LOG.exception(_('Failed to get metadata for ip: %s'), remote_address) - resp = webob.Response() - resp.status = 500 - message = _('An unknown error has occurred. ' - 'Please try your request again.') - resp.body = str(utils.utf8(message)) - return resp + msg = _('An unknown error has occurred. ' + 'Please try your request again.') + exc = webob.exc.HTTPInternalServerError(explanation=unicode(msg)) + return exc if meta_data is None: LOG.error(_('Failed to get metadata for ip: %s'), remote_address) raise webob.exc.HTTPNotFound() |
