Skip to content

Commit

Permalink
Use proxy auth from the Remote config
Browse files Browse the repository at this point in the history
https://pulp.plan.io/issues/9390
closes #9390

(cherry picked from commit f97df48)
  • Loading branch information
fao89 committed Sep 13, 2021
1 parent 1921581 commit ec871a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/9390.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use proxy auth credentials of a Remote when syncing content.
11 changes: 9 additions & 2 deletions pulp_ansible/app/downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit ec871a4

Please sign in to comment.