]> git-server-git.apps.pok.os.sepia.ceph.com Git - radosgw-agent.git/commitdiff
Treat HTTP 500 as any other HTTP error for a copy request
authorJosh Durgin <jdurgin@redhat.com>
Mon, 24 Nov 2014 23:59:20 +0000 (15:59 -0800)
committerJosh Durgin <jdurgin@redhat.com>
Mon, 24 Nov 2014 23:59:22 +0000 (15:59 -0800)
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 <jdurgin@redhat.com>
radosgw_agent/tests/test_worker.py
radosgw_agent/worker.py

index 76366b469a7a7969a43d2f183388912b29d104f3..5ab9d3182fc320fe2ac546155b8481cce1e99dd2 100644 (file)
@@ -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
index c7cb6842f4f0f2cc6ee88a77755bce22d94a443f..eff6c898ae9c9a958082c1045894118dc8329494 100644 (file)
@@ -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: