Skip to content

Conversation

@gerrod3
Copy link
Contributor

@gerrod3 gerrod3 commented Apr 4, 2025

Not sure how to properly test this. The big problem is that bandersnatch creates their own aiohttp session in order to download metadata and the packages. I thought by replacing their session with the remote's session (#750) we would get all of the remote's options by default, but I didn't realize that the auth & proxy settings are actually set at download time in the Downloader's _run method (https://github.com/pulp/pulpcore/blob/main/pulpcore/download/http.py#L292-L294). This should fix the regression by patching the get method that bandersnatch's Master class uses to perform requests, but there is no way for me to test it with our current fixtures. The http_proxy fixture doesn't give access to the proxy's request logs, just the data used to setup the proxy.

Copy link
Contributor

@dralley dralley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's quite annoying that you can't specify these parameters directly on the ClientSession.

if not isinstance(downloader, HttpDownloader):
raise ValueError("Only HTTP(S) is supported for python syncing")

async with Master(url) as master:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like Bandersnatch Master() has a proxy option you can pass in, but no auth. I assume auth isn't terribly relevant in the ecosystem especially given the primary purpose is just mirroring PyPI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it doesn't have proxy auth, so I think the partial patching is still the best way to go.

@nima-1278
Copy link

I just injected the updated sync.py into the Pulp worker container, and the packages are now being synced successfully. So the change has solved the issue.

@gerrod3 gerrod3 merged commit b051180 into pulp:main Apr 7, 2025
12 checks passed
@patchback
Copy link

patchback bot commented Apr 7, 2025

Backport to 3.13: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.13/b051180dd109dae9da8ebbd18c4b230c4fa789b4/pr-824

Backported as #829

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Apr 7, 2025
Fix proxy-sync regression

(cherry picked from commit b051180)
@gerrod3 gerrod3 deleted the proxy-fix-again branch April 7, 2025 21:50
gerrod3 added a commit that referenced this pull request Apr 7, 2025
…09dae9da8ebbd18c4b230c4fa789b4/pr-824

[PR #824/b051180d backport][3.13] Fix proxy-sync regression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants