diff --git a/swift/container/sync.py b/swift/container/sync.py index 0f31bbe433..bdde696722 100644 --- a/swift/container/sync.py +++ b/swift/container/sync.py @@ -382,7 +382,9 @@ class ContainerSync(Daemon): # non-404 one. We don't want to mistakenly assume the # object no longer exists just because one says so and # the others errored for some other reason. - if not exc or exc.http_status == HTTP_NOT_FOUND: + if not exc or getattr( + exc, 'http_status', HTTP_NOT_FOUND) == \ + HTTP_NOT_FOUND: exc = err except (Exception, Timeout) as err: exc = err diff --git a/test/unit/container/test_sync.py b/test/unit/container/test_sync.py index 883d200f11..0f45aa2acb 100644 --- a/test/unit/container/test_sync.py +++ b/test/unit/container/test_sync.py @@ -830,7 +830,10 @@ class TestContainerSync(unittest.TestCase): def fake_direct_get_object(node, part, account, container, obj, resp_chunk_size=1): - exc.append(ClientException('test client exception')) + if len(exc) == 0: + exc.append(Exception('test other exception')) + else: + exc.append(ClientException('test client exception')) raise exc[-1] sync.direct_get_object = fake_direct_get_object @@ -844,6 +847,8 @@ class TestContainerSync(unittest.TestCase): 'container': 'c'}, realm, realm_key)) self.assertEquals(cs.container_puts, 2) self.assertEquals(len(exc), 3) + self.assertEquals(str(exc[-3]), 'test other exception') + self.assertEquals(str(exc[-2]), 'test client exception') self.assertEquals(str(exc[-1]), 'test client exception') def fake_direct_get_object(node, part, account, container, obj,