Fixed error in container sync exc handling
If container sync got a non-ClientException and then a ClientException during a get/put operation, it previously would break in the error handling. Change-Id: Ib2fa70270f3ec870bf60d5bbb3e8f514aeeb0927
This commit is contained in:
parent
bc67415b93
commit
bf292ae0cb
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user