From 9dbe0b42d5081eb99b74952a8ee6d508e6526985 Mon Sep 17 00:00:00 2001 From: Ina Panova Date: Tue, 8 Mar 2022 12:44:43 +0100 Subject: [PATCH] Fixed check for the signature source location. closes #617 --- CHANGES/617.bugfix | 1 + pulp_container/app/tasks/sync_stages.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 CHANGES/617.bugfix diff --git a/CHANGES/617.bugfix b/CHANGES/617.bugfix new file mode 100644 index 000000000..ad1d716b9 --- /dev/null +++ b/CHANGES/617.bugfix @@ -0,0 +1 @@ +Fixed check for the signature source location. diff --git a/pulp_container/app/tasks/sync_stages.py b/pulp_container/app/tasks/sync_stages.py index b6f49578b..da61bfdcc 100644 --- a/pulp_container/app/tasks/sync_stages.py +++ b/pulp_container/app/tasks/sync_stages.py @@ -87,13 +87,16 @@ async def get_signature_source(self): registry_v2_url = urljoin(self.remote.url, "v2") extension_check_downloader = self.remote.get_noauth_downloader(url=registry_v2_url) + response_headers = {} try: await extension_check_downloader.run() + response_headers = extension_check_downloader.response_headers except aiohttp.client_exceptions.ClientResponseError as exc: - if exc.status in [200, 401]: + if exc.status == 401: response_headers = dict(exc.headers) - if response_headers.get(SIGNATURE_HEADER) == "1": - return SIGNATURE_SOURCE.API_EXTENSION + finally: + if response_headers.get(SIGNATURE_HEADER) == "1": + return SIGNATURE_SOURCE.API_EXTENSION tag_list = [] tag_dcs = []