From ec871a443456394f9761d33e2ee00dcff4e881e4 Mon Sep 17 00:00:00 2001 From: Fabricio Aguiar Date: Tue, 13 Jul 2021 11:08:27 -0300 Subject: [PATCH] Use proxy auth from the Remote config https://pulp.plan.io/issues/9390 closes #9390 (cherry picked from commit f97df48317caefa55912a2ad0a61be1e922f43a0) --- CHANGES/9390.bugfix | 1 + pulp_ansible/app/downloaders.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 CHANGES/9390.bugfix diff --git a/CHANGES/9390.bugfix b/CHANGES/9390.bugfix new file mode 100644 index 000000000..28f9a5d39 --- /dev/null +++ b/CHANGES/9390.bugfix @@ -0,0 +1 @@ +Use proxy auth credentials of a Remote when syncing content. diff --git a/pulp_ansible/app/downloaders.py b/pulp_ansible/app/downloaders.py index b19bd8e78..a247a9769 100644 --- a/pulp_ansible/app/downloaders.py +++ b/pulp_ansible/app/downloaders.py @@ -130,7 +130,9 @@ async def _run_with_additional_headers(self, headers): more information. """ await asyncio.sleep(0.75) - async with self.session.get(self.url, headers=headers, proxy=self.proxy) as response: + async with self.session.get( + self.url, headers=headers, proxy=self.proxy, proxy_auth=self.proxy_auth, auth=self.auth + ) as response: self.raise_for_status(response) to_return = await self._handle_response(response) await response.release() @@ -159,7 +161,12 @@ async def get_or_update_token(self): } url = self.ansible_auth_url async with self.session.post( - url, data=form_payload, proxy=self.proxy, raise_for_status=True + url, + data=form_payload, + proxy=self.proxy, + proxy_auth=self.proxy_auth, + auth=self.auth, + raise_for_status=True, ) as response: token_data = await response.text()