Retry container gets in upload-logs-swift

We have been getting HTTP 401 unauthorized errors at the rate of about
once a day when trying to get containers in the swift logs role.
Manually getting and posting objects to the same container after the
jobs fail seems to work so this appears to be a transient failure.

Attempt to workaround this by retrying the container get calls several
times.

Change-Id: Ia7395ffa0b120fbbecde0c9bb6e8583078167143
This commit is contained in:
Clark Boylan 2019-09-13 08:36:41 -07:00
parent 1aacb23399
commit 287880a63a

@ -509,7 +509,12 @@ class Uploader():
except keystoneauth1.exceptions.catalog.EndpointNotFound:
cdn_url = None
if not self.cloud.get_container(self.container):
# We retry here because sometimes we get HTTP 401 errors in rax.
# They seem to happen infrequently (on the order of once a day across
# all jobs) so a retry is likely to work.
container = retry_function(
lambda: self.cloud.get_container(self.container))
if not container:
retry_function(
lambda: self.cloud.create_container(
name=self.container, public=public))