Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility for pulpcore 3.70 #1927

Merged
merged 4 commits into from
Feb 17, 2025
Merged

Add compatibility for pulpcore 3.70 #1927

merged 4 commits into from
Feb 17, 2025

Conversation

gerrod3
Copy link
Contributor

@gerrod3 gerrod3 commented Feb 11, 2025

Hopefully I got everything...

@gerrod3 gerrod3 marked this pull request as ready for review February 14, 2025 17:34
@@ -691,7 +691,8 @@ def get(self, request):
if images:
results.append({"Name": distribution.base_path, "Images": images})

return Response(data={"Registry": settings.CONTENT_ORIGIN, "Results": results})
host = settings.CONTENT_ORIGIN or request.get_host()
Copy link
Member

Choose a reason for hiding this comment

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

This is the very thing that won't work with badly configured reverse proxy, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but it's the best we can do I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

request.get_host() does not return the URL scheme/proto, right?
I was worried about flatpak client somehow needing it (or checking the URL format), but it seems like it does not use the /index/dynamic endpoint, so if no other "integrator" depends on it, I think we are fine.

@@ -1,4 +1,3 @@
mock
pytest-django
pulp-smash @ git+https://github.com/pulp/pulp-smash.git
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove it from functest_requirements too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did, the files in git are in alphabetically order.

Comment on lines 29 to +32
return self.distribution.redirect_to_content_app(
f"{settings.CONTENT_ORIGIN}/pulp/container/{self.path}/{content_type}/{content_id}"
urljoin(
settings.CONTENT_ORIGIN, f"/pulp/container/{self.path}/{content_type}/{content_id}"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

The redirect here would fail in case CONTENT_ORIGIN=None, right?
What if we do something like

    host = settings.CONTENT_ORIGIN or f"{request.scheme}://{request.get_host()}"
    urljoin(
                host, f"/pulp/container/{self.path}/{content_type}/{content_id}"
            )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The django documentation says it allows for relative urls (https://docs.djangoproject.com/en/4.2/topics/http/shortcuts/#redirect) so if CONTENT_ORIGIN=None this should return a relative path for the redirect. I assume that it works since I'm testing the setting being None in the S3 runner.

Copy link
Contributor

Choose a reason for hiding this comment

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

ohh...nice!!
Thank you for the clarification!

@gerrod3 gerrod3 merged commit 4a060f0 into pulp:main Feb 17, 2025
12 checks passed
@gerrod3 gerrod3 deleted the 370-compat branch February 17, 2025 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants