The fix for 699654 which uses exception.args[0] breaks if args is empty and covers up the underlying exception. For example:
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/eventlet/wsgi.py", line 336, in handle_one_response
result = self.application(self.environ, start_response)
File "/usr/lib/pymodules/python2.6/paste/urlmap.py", line 203, in __call__
return app(environ, start_response)
File "/usr/lib/pymodules/python2.6/webob/dec.py", line 147, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/usr/lib/pymodules/python2.6/webob/dec.py", line 208, in call_func
return self.func(req, *args, **kwargs)
File "/usr/lib/pymodules/python2.6/nova/api/ec2/__init__.py", line 59, in __call__
rv = req.get_response(self.application)
File "/usr/lib/pymodules/python2.6/webob/request.py", line 919, in get_response
application, catch_exc_info=False)
File "/usr/lib/pymodules/python2.6/webob/request.py", line 887, in call_application
app_iter = application(self.environ, start_response)
File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__
return resp(environ, start_response)
File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__
return resp(environ, start_response)
File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__
return resp(environ, start_response)
File "/usr/lib/pymodules/python2.6/webob/dec.py", line 147, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/usr/lib/pymodules/python2.6/webob/dec.py", line 208, in call_func
return self.func(req, *args, **kwargs)
File "/usr/lib/pymodules/python2.6/nova/api/ec2/__init__.py", line 328, in __call__
LOG.exception(_('Unexpected error raised: %s'), ex.args[0],
IndexError: tuple index out of range
Perhaps we should coerce the exceptions to unicode instead?
Please test with the below patch. If see any problem in this patch please let me know. Thanks.
=== modified file 'nova/api/ ec2/__init_ _.py' ec2/__init_ _.py 2011-01-27 22:10:42 +0000 ec2/__init_ _.py 2011-01-29 00:03:03 +0000
req.path) NotFound, exception. NotAuthorized) as ex: _("Authenticati on Failure: %s"), ex.args[0]) _("Authenticati on Failure: %s"), utils.utf8(ex)) HTTPForbidden( )
--- nova/api/
+++ nova/api/
@@ -171,7 +171,7 @@
# Be explicit for what exceptions are 403, the rest bubble as 500
except (exception.
- LOG.audit(
+ LOG.audit(
raise webob.exc.
# Authenticated! invoke( context) InstanceNotFoun d as ex: _('InstanceNotF ound raised: %s'), ex.args[0], _('InstanceNotF ound raised: %s'), utils.utf8(ex),
context= context) to_ec2_ id(ex.instance_ id)
message = _('Instance %s not found') % ec2_id VolumeNotFound as ex: _('VolumeNotFou nd raised: %s'), ex.args[0], _('VolumeNotFou nd raised: %s'), utils.utf8(ex),
context= context) to_ec2_ id(ex.volume_ id, 'vol-%08x')
message = _('Volume %s not found') % ec2_id _('NotFound raised: %s'), ex.args[0], context=context) _('NotFound raised: %s'), utils.utf8(ex), context=context) _('ApiError raised: %s'), ex.args[0], _('ApiError raised: %s'), utils.utf8(ex),
context= context) _('Unexpected error raised: %s'), ex.args[0], _('Unexpected error raised: %s'), utils.utf8(ex),
extra= extra, context=context)
context,
@@ -316,30 +316,31 @@
try:
result = api_request.
except exception.
- LOG.info(
+ LOG.info(
ec2_id = cloud.id_
return self._error(req, context, type(ex).__name__, message)
except exception.
- LOG.info(
+ LOG.info(
ec2_id = cloud.id_
return self._error(req, context, type(ex).__name__, message)
except exception.NotFound as ex:
- LOG.info(
- return self._error(req, context, type(ex).__name__, ex.args[0])
+ LOG.info(
+ return self._error(req, context, type(ex).__name__, utils.utf8(ex))
except exception.ApiError as ex:
- LOG.exception(
+ LOG.exception(
if ex.code:
- return self._error(req, context, ex.code, ex.args[0])
+ return self._error(req, context, ex.code, utils.utf8(ex))
else:
- return self._error(req, context, type(ex).__name__, ex.args[0])
+ return self._error(req, context, type(ex).__name_,
+ utils.utf8(ex))
except Exception as ex:
extra = {'environment': req.environ}
- LOG.exception(
+ LOG.exception(
return self._error(req,
=== modified file 'nova/utils.py'
--- nova/utils.py 2011-01-27 19:52:10 +0000
+++ nova/utils.py 2011-01-28 23:45:43 +0000
@@ -405,6 +405,12 @@
"""
if isinstance(value, unicode):
return value.encode...