Merge "versioned_writes: stop trying to catch HTTPPreconditionFailed"
This commit is contained in:
@@ -259,18 +259,16 @@ class VersionedWritesContext(WSGIContext):
|
|||||||
def _listing_iter(self, account_name, lcontainer, lprefix, req):
|
def _listing_iter(self, account_name, lcontainer, lprefix, req):
|
||||||
try:
|
try:
|
||||||
for page in self._listing_pages_iter(account_name, lcontainer,
|
for page in self._listing_pages_iter(account_name, lcontainer,
|
||||||
lprefix, req.environ):
|
lprefix, req):
|
||||||
for item in page:
|
for item in page:
|
||||||
yield item
|
yield item
|
||||||
except ListingIterNotFound:
|
except ListingIterNotFound:
|
||||||
pass
|
pass
|
||||||
except HTTPPreconditionFailed:
|
|
||||||
raise HTTPPreconditionFailed(request=req)
|
|
||||||
except ListingIterError:
|
except ListingIterError:
|
||||||
raise HTTPServerError(request=req)
|
raise HTTPServerError(request=req)
|
||||||
|
|
||||||
def _in_proxy_reverse_listing(self, account_name, lcontainer, lprefix,
|
def _in_proxy_reverse_listing(self, account_name, lcontainer, lprefix,
|
||||||
env, failed_marker, failed_listing):
|
req, failed_marker, failed_listing):
|
||||||
'''Get the complete prefix listing and reverse it on the proxy.
|
'''Get the complete prefix listing and reverse it on the proxy.
|
||||||
|
|
||||||
This is only necessary if we encounter a response from a
|
This is only necessary if we encounter a response from a
|
||||||
@@ -301,7 +299,7 @@ class VersionedWritesContext(WSGIContext):
|
|||||||
try:
|
try:
|
||||||
for page in self._listing_pages_iter(
|
for page in self._listing_pages_iter(
|
||||||
account_name, lcontainer, lprefix,
|
account_name, lcontainer, lprefix,
|
||||||
env, marker, end_marker=failed_marker, reverse=False):
|
req, marker, end_marker=failed_marker, reverse=False):
|
||||||
complete_listing.extend(page)
|
complete_listing.extend(page)
|
||||||
except ListingIterNotFound:
|
except ListingIterNotFound:
|
||||||
pass
|
pass
|
||||||
@@ -311,7 +309,7 @@ class VersionedWritesContext(WSGIContext):
|
|||||||
return reversed(complete_listing)
|
return reversed(complete_listing)
|
||||||
|
|
||||||
def _listing_pages_iter(self, account_name, lcontainer, lprefix,
|
def _listing_pages_iter(self, account_name, lcontainer, lprefix,
|
||||||
env, marker='', end_marker='', reverse=True):
|
req, marker='', end_marker='', reverse=True):
|
||||||
'''Get "pages" worth of objects that start with a prefix.
|
'''Get "pages" worth of objects that start with a prefix.
|
||||||
|
|
||||||
The optional keyword arguments ``marker``, ``end_marker``, and
|
The optional keyword arguments ``marker``, ``end_marker``, and
|
||||||
@@ -327,7 +325,7 @@ class VersionedWritesContext(WSGIContext):
|
|||||||
'''
|
'''
|
||||||
while True:
|
while True:
|
||||||
lreq = make_pre_authed_request(
|
lreq = make_pre_authed_request(
|
||||||
env, method='GET', swift_source='VW',
|
req.environ, method='GET', swift_source='VW',
|
||||||
path=quote('/v1/%s/%s' % (account_name, lcontainer)))
|
path=quote('/v1/%s/%s' % (account_name, lcontainer)))
|
||||||
lreq.environ['QUERY_STRING'] = \
|
lreq.environ['QUERY_STRING'] = \
|
||||||
'prefix=%s&marker=%s' % (quote(lprefix), quote(marker))
|
'prefix=%s&marker=%s' % (quote(lprefix), quote(marker))
|
||||||
@@ -342,7 +340,7 @@ class VersionedWritesContext(WSGIContext):
|
|||||||
if lresp.status_int == HTTP_NOT_FOUND:
|
if lresp.status_int == HTTP_NOT_FOUND:
|
||||||
raise ListingIterNotFound()
|
raise ListingIterNotFound()
|
||||||
elif is_client_error(lresp.status_int):
|
elif is_client_error(lresp.status_int):
|
||||||
raise HTTPPreconditionFailed()
|
raise HTTPPreconditionFailed(request=req)
|
||||||
else:
|
else:
|
||||||
raise ListingIterError()
|
raise ListingIterError()
|
||||||
|
|
||||||
@@ -362,7 +360,7 @@ class VersionedWritesContext(WSGIContext):
|
|||||||
# Apparently there's at least one pre-2.6.0 container server
|
# Apparently there's at least one pre-2.6.0 container server
|
||||||
yield self._in_proxy_reverse_listing(
|
yield self._in_proxy_reverse_listing(
|
||||||
account_name, lcontainer, lprefix,
|
account_name, lcontainer, lprefix,
|
||||||
env, marker, sublisting)
|
req, marker, sublisting)
|
||||||
return
|
return
|
||||||
|
|
||||||
marker = last_item
|
marker = last_item
|
||||||
|
|||||||
Reference in New Issue
Block a user