-
Notifications
You must be signed in to change notification settings - Fork 46
[PULP-1254] Serve Python content form a repository version #1336
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Added support for serving Python content form a repository version. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,24 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En | |
| body["publication"] = None | ||
| if "repository" not in body and "publication" in body: | ||
| body["repository"] = None | ||
|
|
||
| if self.pulp_ctx.has_plugin(PluginRequirement("python", specifier=">=3.21.0")): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens when you specify --version on pulp_python<3.21?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CLI returns
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a corresponding "needs_version" to the top of this method? |
||
| version = body.pop("version", None) | ||
| if version is not None: | ||
| if repository_href := body.pop("repository", None): | ||
| body["repository_version"] = f"{repository_href}versions/{version}/" | ||
| body["repository"] = None | ||
| else: | ||
| current_entity = self.entity | ||
| if repository_href := current_entity.get("repository"): | ||
| body["repository_version"] = f"{repository_href}versions/{version}/" | ||
| body["repository"] = None | ||
| elif repository_version_href := current_entity.get("repository_version"): | ||
| repository_href = repository_version_href.partition("versions")[0] | ||
| body["repository_version"] = f"{repository_href}versions/{version}/" | ||
| elif "repository" in body: | ||
| body["repository_version"] = None | ||
|
|
||
| return body | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,15 @@ def distribution(ctx: click.Context, pulp_ctx: PulpCLIContext, /, distribution_t | |
| ), | ||
| ), | ||
| repository_option, | ||
| pulp_option( | ||
| "--version", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if you specify the version and no repository?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| type=int, | ||
| help=_( | ||
| "A repository version number, leave blank for latest." | ||
| " When set, repository will no longer be auto-distributed." | ||
| ), | ||
| needs_plugins=[PluginRequirement("python", specifier=">=3.21.0")], | ||
| ), | ||
| content_guard_option, | ||
| pulp_option( | ||
| "--allow-uploads/--block-uploads", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the "we don't need no publication" effort, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it is more like "we can specify the repository version directly, even without using a publication"