From: Josh Durgin Date: Mon, 24 Nov 2014 23:59:20 +0000 (-0800) Subject: Treat HTTP 500 as any other HTTP error for a copy request X-Git-Tag: v1.2~5^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bcf04288e1ca0207529be3fb8a6a7778d14afb60;p=radosgw-agent.git Treat HTTP 500 as any other HTTP error for a copy request We still want to retry later, since 500 could be the gateway timing out, or it being upgraded to fix a bug, etc. Signed-off-by: Josh Durgin --- diff --git a/radosgw_agent/tests/test_worker.py b/radosgw_agent/tests/test_worker.py index 76366b4..5ab9d31 100644 --- a/radosgw_agent/tests/test_worker.py +++ b/radosgw_agent/tests/test_worker.py @@ -81,11 +81,11 @@ class TestSyncObject(object): w = worker.DataWorker(None, None, None, self.src, None, daemon_id=1) w.wait_for_object = lambda *a: None - with py.test.raises(client.HttpError) as exc: + with py.test.raises(worker.SyncFailed) as exc: w.sync_object('mah-bucket', 'mah-object') exc_message = exc.exconly() - assert 'error code 500 content Internal Server Error' in exc_message + assert 'HTTP error with status: 500' in exc_message def test_fails_to_remove_op_state(self, capsys): # really tricky to test this one, we are forced to just use `capsys` from py.test diff --git a/radosgw_agent/worker.py b/radosgw_agent/worker.py index c7cb684..eff6c89 100644 --- a/radosgw_agent/worker.py +++ b/radosgw_agent/worker.py @@ -198,15 +198,8 @@ class DataWorker(Worker): except client.HttpError as e: # if we have a non-critical Http error, raise a SyncFailed # so that we can retry this. The Gateway may be returning 400's - if e.str_code[0] in ['3', '4']: - msg = 'encountered an HTTP error with status: %s' % e.str_code - raise SyncFailed(msg) - else: - # if the error is critical, as in anything that is a 500 - # raise - log.exception('got a critical http error from client') - raise - + msg = 'encountered an HTTP error with status: %s' % e.str_code + raise SyncFailed(msg) except SyncFailed: raise except Exception as e: