Merge "Quiet more BadStatusLine tracebacks"
This commit is contained in:
commit
a846225c39
@ -71,7 +71,10 @@ import codecs
|
|||||||
utf8_decoder = codecs.getdecoder('utf-8')
|
utf8_decoder = codecs.getdecoder('utf-8')
|
||||||
utf8_encoder = codecs.getencoder('utf-8')
|
utf8_encoder = codecs.getencoder('utf-8')
|
||||||
import six
|
import six
|
||||||
if not six.PY2:
|
if six.PY2:
|
||||||
|
from eventlet.green import httplib as green_http_client
|
||||||
|
else:
|
||||||
|
from eventlet.green.http import client as green_http_client
|
||||||
utf16_decoder = codecs.getdecoder('utf-16')
|
utf16_decoder = codecs.getdecoder('utf-16')
|
||||||
utf16_encoder = codecs.getencoder('utf-16')
|
utf16_encoder = codecs.getencoder('utf-16')
|
||||||
from six.moves import cPickle as pickle
|
from six.moves import cPickle as pickle
|
||||||
@ -2242,7 +2245,8 @@ class LogAdapter(logging.LoggerAdapter, object):
|
|||||||
emsg = _('Broken pipe')
|
emsg = _('Broken pipe')
|
||||||
else:
|
else:
|
||||||
call = self._exception
|
call = self._exception
|
||||||
elif isinstance(exc, http_client.BadStatusLine):
|
elif isinstance(exc, (http_client.BadStatusLine,
|
||||||
|
green_http_client.BadStatusLine)):
|
||||||
# Use error(); not really exceptional
|
# Use error(); not really exceptional
|
||||||
emsg = '%s: %s' % (exc.__class__.__name__, exc.line)
|
emsg = '%s: %s' % (exc.__class__.__name__, exc.line)
|
||||||
elif isinstance(exc, eventlet.Timeout):
|
elif isinstance(exc, eventlet.Timeout):
|
||||||
|
@ -84,6 +84,11 @@ from swift.common.swob import Request, Response
|
|||||||
from test.unit import requires_o_tmpfile_support_in_tmp, \
|
from test.unit import requires_o_tmpfile_support_in_tmp, \
|
||||||
quiet_eventlet_exceptions
|
quiet_eventlet_exceptions
|
||||||
|
|
||||||
|
if six.PY2:
|
||||||
|
import eventlet.green.httplib as green_http_client
|
||||||
|
else:
|
||||||
|
import eventlet.green.http.client as green_http_client
|
||||||
|
|
||||||
threading = eventlet.patcher.original('threading')
|
threading = eventlet.patcher.original('threading')
|
||||||
|
|
||||||
|
|
||||||
@ -1989,6 +1994,13 @@ class TestUtils(unittest.TestCase):
|
|||||||
self.assertIn('BadStatusLine', log_msg)
|
self.assertIn('BadStatusLine', log_msg)
|
||||||
self.assertIn("''", log_msg)
|
self.assertIn("''", log_msg)
|
||||||
|
|
||||||
|
# green version is separate :-(
|
||||||
|
log_exception(green_http_client.BadStatusLine(''))
|
||||||
|
log_msg = strip_value(sio)
|
||||||
|
self.assertNotIn('Traceback', log_msg)
|
||||||
|
self.assertIn('BadStatusLine', log_msg)
|
||||||
|
self.assertIn("''", log_msg)
|
||||||
|
|
||||||
# test unhandled
|
# test unhandled
|
||||||
log_exception(Exception('my error message'))
|
log_exception(Exception('my error message'))
|
||||||
log_msg = strip_value(sio)
|
log_msg = strip_value(sio)
|
||||||
|
Loading…
Reference in New Issue
Block a user