From 608490e451419e2f42b79822339f6c644dd7043a Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Thu, 16 Jul 2026 13:24:09 +0200 Subject: [PATCH 1/2] Drop quirks and workarounds for pulpcore<3.49 --- CHANGES/pulp-glue/+cleanup_3.49.removal | 1 + pulp-glue/src/pulp_glue/certguard/context.py | 4 +- pulp-glue/src/pulp_glue/common/context.py | 133 +++-------- pulp-glue/src/pulp_glue/core/context.py | 223 ++---------------- pulp-glue/src/pulp_glue/file/context.py | 52 ++-- pulp-glue/src/pulp_glue/python/context.py | 9 +- pulp-glue/src/pulp_glue/rpm/context.py | 9 +- pulp-glue/tests/test_api_quirks.py | 4 - src/pulp_cli/generic.py | 1 - src/pulpcore/cli/container/distribution.py | 1 - src/pulpcore/cli/core/distribution.py | 3 +- src/pulpcore/cli/core/generic.py | 3 +- src/pulpcore/cli/core/group.py | 92 +------- src/pulpcore/cli/core/orphan.py | 4 +- src/pulpcore/cli/core/publication.py | 2 - src/pulpcore/cli/core/task.py | 11 +- src/pulpcore/cli/core/user.py | 14 +- src/pulpcore/cli/file/repository.py | 7 +- tests/scripts/pulp_ansible/test_content.sh | 7 +- tests/scripts/pulp_file/test_distribution.sh | 9 +- tests/scripts/pulp_file/test_publication.sh | 11 +- tests/scripts/pulp_file/test_repository.sh | 14 +- tests/scripts/pulpcore/test_content_guards.sh | 26 +- tests/scripts/pulpcore/test_task.sh | 58 ++--- tests/scripts/test_debug.sh | 2 +- tests/{test_prn_unit.py => test_prn_regex.py} | 0 26 files changed, 145 insertions(+), 555 deletions(-) create mode 100644 CHANGES/pulp-glue/+cleanup_3.49.removal rename tests/{test_prn_unit.py => test_prn_regex.py} (100%) diff --git a/CHANGES/pulp-glue/+cleanup_3.49.removal b/CHANGES/pulp-glue/+cleanup_3.49.removal new file mode 100644 index 000000000..8eb8845f0 --- /dev/null +++ b/CHANGES/pulp-glue/+cleanup_3.49.removal @@ -0,0 +1 @@ +Removed compatibility checks and workaround for pulpcore < 3.49. diff --git a/pulp-glue/src/pulp_glue/certguard/context.py b/pulp-glue/src/pulp_glue/certguard/context.py index 73853a191..68f138ec3 100644 --- a/pulp-glue/src/pulp_glue/certguard/context.py +++ b/pulp-glue/src/pulp_glue/certguard/context.py @@ -12,7 +12,7 @@ class PulpX509CertGuardContext(PulpContentGuardContext): ENTITIES = _("x509 certguards") HREF = "certguard_x509_cert_guard_href" ID_PREFIX = "contentguards_certguard_x509" - NEEDS_PLUGINS = [PluginRequirement("certguard", specifier=">=1.4.0")] + NEEDS_PLUGINS = [PluginRequirement("certguard")] class PulpRHSMCertGuardContext(PulpContentGuardContext): @@ -22,4 +22,4 @@ class PulpRHSMCertGuardContext(PulpContentGuardContext): ENTITIES = _("RHSM certguards") HREF = "certguard_r_h_s_m_cert_guard_href" ID_PREFIX = "contentguards_certguard_rhsm" - NEEDS_PLUGINS = [PluginRequirement("certguard", specifier=">=1.4.0")] + NEEDS_PLUGINS = [PluginRequirement("certguard")] diff --git a/pulp-glue/src/pulp_glue/common/context.py b/pulp-glue/src/pulp_glue/common/context.py index 46fc35d47..491fd976b 100644 --- a/pulp-glue/src/pulp_glue/common/context.py +++ b/pulp-glue/src/pulp_glue/common/context.py @@ -205,38 +205,6 @@ def _patch_api_hook(spec: t.Any) -> t.Any: return spec -@api_spec_quirk(PluginRequirement("core", specifier="<3.20.0")) -def patch_ordering_filters(api_spec: t.Any) -> t.Any: - for path, method, operation_id, operation in walk_operations(api_spec): - if method == "get" and "parameters" in operation: - for parameter in operation["parameters"]: - if ( - parameter["name"] == "ordering" - and parameter["in"] == "query" - and "schema" in parameter - and parameter["schema"]["type"] == "string" - ): - parameter["schema"] = {"type": "array", "items": {"type": "string"}} - parameter["explode"] = False - parameter["style"] = "form" - return api_spec - - -@api_spec_quirk(PluginRequirement("core", specifier="<3.22.0")) -def patch_field_select_filters(api_spec: t.Any) -> t.Any: - for path, method, operation_id, operation in walk_operations(api_spec): - if method == "get" and "parameters" in operation: - for parameter in operation["parameters"]: - if ( - parameter["name"] in ["fields", "exclude_fields"] - and parameter["in"] == "query" - and "schema" in parameter - and parameter["schema"]["type"] == "string" - ): - parameter["schema"] = {"type": "array", "items": {"type": "string"}} - return api_spec - - @api_spec_quirk(PluginRequirement("core", specifier="<99.99.0")) def patch_content_in_query_filters(api_spec: t.Any) -> t.Any: # https://github.com/pulp/pulpcore/issues/3634 @@ -259,13 +227,6 @@ def patch_content_in_query_filters(api_spec: t.Any) -> t.Any: return api_spec -@api_spec_quirk(PluginRequirement("core", specifier=">=3.23,<3.30.0")) -def patch_upstream_pulp_replicate_request_body(api_spec: t.Any) -> t.Any: - operation = api_spec["paths"]["{upstream_pulp_href}replicate/"]["post"] - operation.pop("requestBody", None) - return api_spec - - @api_spec_quirk(PluginRequirement("core", specifier="<3.85")) def patch_security_scheme_mutual_tls(api_spec: t.Any) -> t.Any: # Trick to allow tls cert auth on older Pulp. @@ -343,6 +304,7 @@ def __init__( # If this is "only" true and we have the PULP_CA_BUNDLE variable set, use it. self.verify_ssl = os.environ.get("PULP_CA_BUNDLE", True) self._needed_plugins: list[PluginRequirement] = [ + # This should be the currently oldest supported release branch. PluginRequirement("core", specifier=">=3.49.0") ] self.pulp_domain: str = domain @@ -829,15 +791,16 @@ class PulpEntityContext(PulpViewSetContext): """ List of capabilities this entity provides. - Subclasses can specify version dependent capabilities here + Subclasses can specify version dependent capabilities here. Example: ``` CAPABILITIES = { "feature1": [ PluginRequirement("file"), - PluginRequirement("core", specifier=">=3.7.0") + PluginRequirement("core", specifier=">=5.6.7") ] + "feature2": [], # Feature2 does not depend on any extra versions/plugins. } ``` """ @@ -1245,20 +1208,19 @@ def set_label(self, key: str, value: str, non_blocking: bool = False) -> t.Any: assert self._entity is not None self._entity["pulp_labels"][key] = value return None - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.34.0")): - try: - return self.call( - "set_label", - parameters={self.HREF: self.pulp_href}, - body={"key": key, "value": value}, - ) - except PulpHTTPError as e: - if e.status_code != 403: - raise - # Workaround for broken access policies: Try the old mechanism. - labels = self.entity["pulp_labels"] - labels[key] = value - return self.update(body={"pulp_labels": labels}, non_blocking=non_blocking) + try: + return self.call( + "set_label", + parameters={self.HREF: self.pulp_href}, + body={"key": key, "value": value}, + ) + except PulpHTTPError as e: + if e.status_code != 403: + raise + # Workaround for broken access policies: Try the old mechanism. + labels = self.entity["pulp_labels"] + labels[key] = value + return self.update(body={"pulp_labels": labels}, non_blocking=non_blocking) def unset_label(self, key: str, non_blocking: bool = False) -> t.Any: """ @@ -1274,23 +1236,23 @@ def unset_label(self, key: str, non_blocking: bool = False) -> t.Any: assert self._entity is not None self._entity["pulp_labels"].pop(key) return None - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.34.0")): - try: - return self.call( - "unset_label", - parameters={self.HREF: self.pulp_href}, - body={"key": key}, - ) - except PulpHTTPError as e: - if e.status_code != 403: - raise - # Workaround for broken access policies: Try the old mechanism. - labels = self.entity["pulp_labels"] + try: - labels.pop(key) - except KeyError: - raise PulpException(_("Could not find label with key '{key}'.").format(key=key)) - return self.update(body={"pulp_labels": labels}, non_blocking=non_blocking) + return self.call( + "unset_label", + parameters={self.HREF: self.pulp_href}, + body={"key": key}, + ) + except PulpHTTPError as e: + if e.status_code != 403: + raise + # Workaround for broken access policies: Try the old mechanism. + labels = self.entity["pulp_labels"] + try: + labels.pop(key) + except KeyError: + raise PulpException(_("Could not find label with key '{key}'.").format(key=key)) + return self.update(body={"pulp_labels": labels}, non_blocking=non_blocking) def show_label(self, key: str) -> str | None: """ @@ -1483,13 +1445,6 @@ def __init_subclass__(cls, **kwargs: t.Any) -> None: ) cls.TYPE_REGISTRY[f"{cls.PLUGIN}:{cls.RESOURCE_TYPE}"] = cls - def list(self, limit: int, offset: int, parameters: dict[str, t.Any]) -> list[t.Any]: - if parameters.get("repository") is not None: - self.pulp_ctx.needs_plugin( - PluginRequirement("core", specifier=">=3.20.0", feature=_("repository filter")) - ) - return super().list(limit, offset, parameters) - class PulpDistributionContext(PulpEntityContext): """Base class for distribution contexts.""" @@ -1627,20 +1582,6 @@ def get_version_context( pulp_ctx=self.pulp_ctx, repository_ctx=self, pulp_href=version_href ) - def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: - body = super().preprocess_entity(body, partial=partial) - if "retain_repo_versions" in body: - self.pulp_ctx.needs_plugin(PluginRequirement("core", specifier=">=3.13.0")) - if ( - self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.13.0,<3.15.0")) - and - # "retain_repo_versions" has been named "retained_versions" until pulpcore 3.15 - # https://github.com/pulp/pulpcore/pull/1472 - "retain_repo_versions" in body - ): - body["retained_versions"] = body.pop("retain_repo_versions") - return body - def sync(self, body: EntityDefinition | None = None) -> t.Any: """ Trigger a sync task for this repository. @@ -1701,7 +1642,6 @@ def reclaim( Returns: Record of the reclaim space task. """ - self.pulp_ctx.needs_plugin(PluginRequirement("core", specifier=">=3.19.0")) body: dict[str, t.Any] = {} body["repo_hrefs"] = repo_hrefs if repo_versions_keeplist: @@ -1762,17 +1702,12 @@ def _prepare_upload( if not self.pulp_ctx.fake_mode: # Skip the uploading part in fake_mode if _chunk_size is None or _chunk_size > size: body["file"] = file - elif self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.20.0")): + else: self.needs_capability("upload") from pulp_glue.core.context import PulpUploadContext upload_href = PulpUploadContext(self.pulp_ctx).upload_file(file, _chunk_size) body["upload"] = upload_href - else: - from pulp_glue.core.context import PulpArtifactContext - - artifact_href = PulpArtifactContext(self.pulp_ctx).upload(file, _chunk_size) - body["artifact"] = artifact_href def create( self, diff --git a/pulp-glue/src/pulp_glue/core/context.py b/pulp-glue/src/pulp_glue/core/context.py index a70e04a77..9fbf9a65b 100644 --- a/pulp-glue/src/pulp_glue/core/context.py +++ b/pulp-glue/src/pulp_glue/core/context.py @@ -27,18 +27,8 @@ class PulpAccessPolicyContext(PulpEntityContext): ID_PREFIX = "access_policies" def reset(self) -> t.Any: - self.pulp_ctx.needs_plugin(PluginRequirement("core", specifier=">=3.17.0")) return self.call("reset", parameters={self.HREF: self.pulp_href}) - def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: - body = super().preprocess_entity(body, partial=partial) - if ( - not self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.17.0")) - and "creation_hooks" in body - ): - body["permissions_assignment"] = body.pop("creation_hooks") - return body - class PulpArtifactContext(PulpEntityContext): ENTITY = _("artifact") @@ -103,7 +93,6 @@ class PulpDomainContext(PulpEntityContext): ENTITIES = _("Pulp domains") HREF = "domain_href" ID_PREFIX = "domains" - NEEDS_PLUGINS = [PluginRequirement("core", specifier=">=3.23.0")] class PulpExporterContext(PulpEntityContext): @@ -128,16 +117,9 @@ def scope(self) -> dict[str, t.Any]: class PulpGroupContext(PulpEntityContext): ENTITY = _("user group") ENTITIES = _("user groups") - # Handled by a workaround - # HREF = "group_href" + HREF = "group_href" ID_PREFIX = "groups" - CAPABILITIES = {"roles": [PluginRequirement("core", specifier=">=3.17.0")]} - - @property - def HREF(self) -> str: # type:ignore - if not self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.17.0")): - return "auth_group_href" - return "group_href" + CAPABILITIES = {"roles": []} def add_user(self, user: "PulpUserContext") -> None: pass @@ -152,94 +134,12 @@ def remove_user(self, user: "PulpUserContext") -> None: group_user_ctx.delete() -class PulpGroupPermissionContext(PulpEntityContext): - ENTITY = _("group permission") - ENTITIES = _("group permissions") - NEEDS_PLUGINS = [PluginRequirement("core", specifier="<3.20.0", feature=_("group permissions"))] - group_ctx: PulpGroupContext - - def __init__(self, pulp_ctx: PulpContext, group_ctx: PulpGroupContext) -> None: - super().__init__(pulp_ctx) - self.group_ctx = group_ctx - - def call( - self, - operation: str, - non_blocking: bool = False, - parameters: dict[str, t.Any] | None = None, - body: dict[str, t.Any] | None = None, - validate_body: bool = False, - ) -> t.Any: - # Workaroud because the openapi spec for GroupPermissions has always been broken. - # - # This will probably not be fixed upstream, and GroupPermissions are removed from pulpcore. - # So we just skip linting here. - return super().call( - operation, - non_blocking=non_blocking, - parameters=parameters, - body=body, - validate_body=validate_body, - ) - - def find(self, **kwargs: t.Any) -> t.Any: - # Workaroud the missing ability to filter. - # # TODO fix upstream and adjust to guard for the proper version - # # https://pulp.plan.io/issues/8241 - # if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.99.dev")): - # # Workaround not needed anymore - # return super().find(**kwargs) - search_result = self.list(limit=sys.maxsize, offset=0, parameters={}) - for key, value in kwargs.items(): - search_result = [res for res in search_result if res[key] == value] - if len(search_result) != 1: - raise PulpException( - _("Could not find {entity} with {kwargs}.").format( - entity=self.ENTITY, kwargs=kwargs - ) - ) - return search_result[0] - - @property - def scope(self) -> dict[str, t.Any]: - return {self.group_ctx.HREF: self.group_ctx.pulp_href} - - -class PulpGroupModelPermissionContext(PulpGroupPermissionContext): - ENTITY = _("group model permission") - ENTITIES = _("group model permissions") - # Handled by a workaround - # HREF = "groups_model_permission_href" - ID_PREFIX = "groups_model_permissions" - - @property - def HREF(self) -> str: # type:ignore - if not self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.17.0")): - return "auth_groups_model_permission_href" - return "groups_model_permission_href" - - -class PulpGroupObjectPermissionContext(PulpGroupPermissionContext): - ENTITY = _("group object permission") - ENTITIES = _("group object permissions") - # Handled by a workaround - # HREF = "groups_object_permission_href" - ID_PREFIX = "groups_object_permissions" - - @property - def HREF(self) -> str: # type:ignore - if not self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.17.0")): - return "auth_groups_object_permission_href" - return "groups_object_permission_href" - - class PulpGroupRoleContext(PulpEntityContext): ENTITY = _("group role") ENTITIES = _("group roles") HREF = "groups_group_role_href" ID_PREFIX = "groups_roles" NULLABLES = {"content_object"} - NEEDS_PLUGINS = [PluginRequirement("core", specifier=">=3.17.0", feature=_("group roles"))] group_ctx: PulpGroupContext def __init__(self, pulp_ctx: PulpContext, group_ctx: PulpGroupContext) -> None: @@ -254,17 +154,10 @@ def scope(self) -> dict[str, t.Any]: class PulpGroupUserContext(PulpEntityContext): ENTITY = _("group user") ENTITIES = _("group users") - # Handled by a workaround - # HREF = "groups_user_href" + HREF = "groups_user_href" ID_PREFIX = "groups_users" group_ctx: PulpGroupContext - @property - def HREF(self) -> str: # type:ignore - if not self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.17.0")): - return "auth_groups_user_href" - return "groups_user_href" - def __init__(self, pulp_ctx: PulpContext, group_ctx: PulpGroupContext) -> None: super().__init__(pulp_ctx) self.group_ctx = group_ctx @@ -285,19 +178,8 @@ class PulpOrphanContext(PulpViewSetContext): ID_PREFIX = "orphans_cleanup" def cleanup(self, body: dict[str, t.Any] | None = None) -> t.Any: - if body is not None: - body = preprocess_payload(body) - if "orphan_protection_time" in body: - self.pulp_ctx.needs_plugin(PluginRequirement("core", specifier=">=3.15.0")) - else: - body = {} - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.14.0")): - result = self.call("cleanup", body=body) - else: - if body: - self.pulp_ctx.needs_plugin(PluginRequirement("core", specifier=">=3.14.0")) - result = {} if self.pulp_ctx.fake_mode else self.pulp_ctx.call("orphans_delete") - return result + body = {} if body is None else preprocess_payload(body) + return self.call("cleanup", body=body) class PulpCompositeContentGuardContext(PulpContentGuardContext): @@ -307,7 +189,6 @@ class PulpCompositeContentGuardContext(PulpContentGuardContext): ENTITIES = "composite content guards" HREF = "composite_content_guard_href" ID_PREFIX = "contentguards_core_composite" - NEEDS_PLUGINS = [PluginRequirement("core", specifier=">=3.43.0")] class PulpContentRedirectContentGuardContext(PulpContentGuardContext): @@ -317,7 +198,6 @@ class PulpContentRedirectContentGuardContext(PulpContentGuardContext): ENTITIES = "content redirect content guards" HREF = "content_redirect_content_guard_href" ID_PREFIX = "contentguards_core_content_redirect" - NEEDS_PLUGINS = [PluginRequirement("core", specifier=">=3.18.0")] class PulpHeaderContentGuardContext(PulpContentGuardContext): @@ -327,7 +207,6 @@ class PulpHeaderContentGuardContext(PulpContentGuardContext): ENTITIES = "header content guards" HREF = "header_content_guard_href" ID_PREFIX = "contentguards_core_header" - NEEDS_PLUGINS = [PluginRequirement("core", specifier=">=3.39.0")] class PulpRbacContentGuardContext(PulpContentGuardContext): @@ -338,8 +217,7 @@ class PulpRbacContentGuardContext(PulpContentGuardContext): HREF = "r_b_a_c_content_guard_href" ID_PREFIX = "contentguards_core_rbac" DOWNLOAD_ROLE: t.ClassVar[str] = "core.rbaccontentguard_downloader" - CAPABILITIES = {"roles": [PluginRequirement("core", specifier=">=3.17.0")]} - NEEDS_PLUGINS = [PluginRequirement("core", specifier=">=3.15.0")] + CAPABILITIES = {"roles": []} def assign( self, @@ -347,15 +225,9 @@ def assign( users: list[str] | None = None, groups: list[str] | None = None, ) -> t.Any: - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.17.0")): - body: EntityDefinition = {"users": users, "groups": groups} - body["role"] = self.DOWNLOAD_ROLE - return self.call("add_role", parameters={self.HREF: href or self.pulp_href}, body=body) - else: - body = {"usernames": users, "groupnames": groups} - return self.call( - "assign_permission", parameters={self.HREF: href or self.pulp_href}, body=body - ) + body: EntityDefinition = {"users": users, "groups": groups} + body["role"] = self.DOWNLOAD_ROLE + return self.call("add_role", parameters={self.HREF: href or self.pulp_href}, body=body) def remove( self, @@ -363,17 +235,9 @@ def remove( users: list[str] | None = None, groups: list[str] | None = None, ) -> t.Any: - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.17.0")): - body: EntityDefinition = {"users": users, "groups": groups} - body["role"] = self.DOWNLOAD_ROLE - return self.call( - "remove_role", parameters={self.HREF: href or self.pulp_href}, body=body - ) - else: - body = {"usernames": users, "groupnames": groups} - return self.call( - "remove_permission", parameters={self.HREF: href or self.pulp_href}, body=body - ) + body: EntityDefinition = {"users": users, "groups": groups} + body["role"] = self.DOWNLOAD_ROLE + return self.call("remove_role", parameters={self.HREF: href or self.pulp_href}, body=body) class PulpRoleContext(PulpEntityContext): @@ -382,7 +246,6 @@ class PulpRoleContext(PulpEntityContext): HREF = "role_href" ID_PREFIX = "roles" NULLABLES = {"description"} - NEEDS_PLUGINS = [PluginRequirement("core", specifier=">=3.17.0")] class PulpSigningServiceContext(PulpEntityContext): @@ -398,49 +261,13 @@ class PulpTaskContext(PulpEntityContext): ENTITIES = _("tasks") HREF = "task_href" ID_PREFIX = "tasks" - CAPABILITIES = {"roles": [PluginRequirement("core", specifier=">=3.17.0")]} + CAPABILITIES = {"roles": []} PLUGIN = "core" MODEL = "task" HREF_TEMPLATE = "tasks/{pulp_id}/" resource_context: PulpEntityContext | None = None - def _list(self, limit: int, offset: int, parameters: dict[str, t.Any]) -> list[t.Any]: - if ( - parameters.get("logging_cid") is not None - or parameters.get("logging_cid__contains") is not None - ): - self.pulp_ctx.needs_plugin(PluginRequirement("core", specifier=">=3.14.0")) - if not self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.22.0")): - parameters = parameters.copy() - reserved_resources = parameters.pop("reserved_resources", None) - exclusive_resources = parameters.pop("exclusive_resources", None) - shared_resources = parameters.pop("shared_resources", None) - if ( - parameters.pop("reserved_resources__in", None) - or parameters.pop("exclusive_resources__in", None) - or parameters.pop("shared_resources__in", None) - ): - self.pulp_ctx.needs_plugin(PluginRequirement("core", specifier=">=3.22.0")) - reserved_resources_record = [] - if reserved_resources: - reserved_resources_record.append(reserved_resources) - if exclusive_resources: - reserved_resources_record.append(exclusive_resources) - if shared_resources: - reserved_resources_record.append("shared:" + shared_resources) - if len(reserved_resources_record) > 1: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "core", - specifier=">=3.22.0", - feature=_("specify multiple reserved resources"), - ), - ) - parameters["reserved_resources_record"] = reserved_resources_record - - return super().list(limit=limit, offset=offset, parameters=parameters) - def cancel(self, task_href: str | None = None, background: bool = False) -> t.Any: task_href = task_href or self.pulp_href task = self.call( @@ -466,10 +293,7 @@ def profile_artifact_urls(self) -> dict[str, str]: @property def scope(self) -> dict[str, t.Any]: if self.resource_context: - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.22.0")): - return {"reserved_resources": self.resource_context.pulp_href} - else: - return {"reserved_resources_record": [self.resource_context.pulp_href]} + return {"reserved_resources": self.resource_context.pulp_href} else: return {} @@ -478,7 +302,6 @@ def purge( finished_before: datetime.datetime | None, states: list[str] | None, ) -> t.Any: - self.pulp_ctx.needs_plugin(PluginRequirement("core", specifier=">=3.17.0")) body: dict[str, t.Any] = {} if finished_before: body["finished_before"] = finished_before @@ -490,20 +313,21 @@ def purge( ) def summary(self) -> dict[str, int]: - task_states = ["waiting", "skipped", "running", "completed", "failed", "canceled"] - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.14.0")): - task_states.append("canceling") + task_states = [ + "waiting", + "skipped", + "running", + "completed", + "failed", + "canceling", + "canceled", + ] result = {} for state in task_states: payload = {"limit": 1, "state": state} result[state] = self.call("list", parameters=payload)["count"] return result - # "list" should be a reserverd word in Python... - # In this scope, we want to use the global "list" for typing hints. - list = _list - del _list - class PulpTaskGroupContext(PulpEntityContext): ENTITY = _("task group") @@ -606,7 +430,6 @@ class PulpUpstreamPulpContext(PulpEntityContext): HREF = "upstream_pulp_href" ID_PREFIX = "upstream_pulps" HREF_PATTERN = r"upstream-pulps/" - NEEDS_PLUGINS = [PluginRequirement("core", specifier=">=3.23.0")] def find(self, **kwargs: t.Any) -> t.Any: # Workaroud the missing ability to filter. diff --git a/pulp-glue/src/pulp_glue/file/context.py b/pulp-glue/src/pulp_glue/file/context.py index baeb47fc5..5d534500d 100644 --- a/pulp-glue/src/pulp_glue/file/context.py +++ b/pulp-glue/src/pulp_glue/file/context.py @@ -10,7 +10,6 @@ PulpRemoteContext, PulpRepositoryContext, PulpRepositoryVersionContext, - api_spec_quirk, ) from pulp_glue.common.exceptions import PulpException from pulp_glue.common.i18n import get_translation @@ -19,13 +18,6 @@ _ = translation.gettext -@api_spec_quirk(PluginRequirement("file", specifier=">=1.10.0,<1.11.0")) -def patch_file_acs_refresh_request_body(api_spec: t.Any) -> t.Any: - operation = api_spec["paths"]["{file_file_alternate_content_source_href}refresh/"]["post"] - operation.pop("requestBody", None) - return api_spec - - class PulpFileACSContext(PulpACSContext): PLUGIN = "file" RESOURCE_TYPE = "file" @@ -33,8 +25,8 @@ class PulpFileACSContext(PulpACSContext): ENTITIES = _("file ACSes") HREF = "file_file_alternate_content_source_href" ID_PREFIX = "acs_file_file" - NEEDS_PLUGINS = [PluginRequirement("file", specifier=">=1.9.0")] - CAPABILITIES = {"roles": [PluginRequirement("file", specifier=">=1.11.0")]} + NEEDS_PLUGINS = [PluginRequirement("file")] + CAPABILITIES = {"roles": []} class PulpFileContentContext(PulpContentContext): @@ -44,7 +36,7 @@ class PulpFileContentContext(PulpContentContext): ENTITIES = _("file content") HREF = "file_file_content_href" ID_PREFIX = "content_file_files" - NEEDS_PLUGINS = [PluginRequirement("file", specifier=">=1.6.0")] + NEEDS_PLUGINS = [PluginRequirement("file")] CAPABILITIES = {"upload": []} def create( @@ -78,16 +70,15 @@ class PulpFileDistributionContext(PulpDistributionContext): ENTITIES = _("file distributions") HREF = "file_file_distribution_href" ID_PREFIX = "distributions_file_file" - CAPABILITIES = {"roles": [PluginRequirement("file", specifier=">=1.11.0")]} - NEEDS_PLUGINS = [PluginRequirement("file", specifier=">=1.6.0")] + CAPABILITIES = {"roles": []} + NEEDS_PLUGINS = [PluginRequirement("file")] def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.16.0")): - if "repository" in body and "publication" not in body: - body["publication"] = None - if "repository" not in body and "publication" in body: - body["repository"] = None + if "repository" in body and "publication" not in body: + body["publication"] = None + if "repository" not in body and "publication" in body: + body["repository"] = None version = body.pop("version", None) if version is not None: @@ -104,7 +95,6 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En PluginRequirement("core", specifier=">=3.106.0") ): body["repository_version"] = None - return body @@ -115,9 +105,9 @@ class PulpFilePublicationContext(PulpPublicationContext): ENTITIES = _("file publications") HREF = "file_file_publication_href" ID_PREFIX = "publications_file_file" - CAPABILITIES = {"roles": [PluginRequirement("file", specifier=">=1.11.0")]} + CAPABILITIES = {"roles": []} NULLABLES = PulpPublicationContext.NULLABLES | {"manifest"} - NEEDS_PLUGINS = [PluginRequirement("file", specifier=">=1.6.0")] + NEEDS_PLUGINS = [PluginRequirement("file")] def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) @@ -135,8 +125,8 @@ class PulpFileRemoteContext(PulpRemoteContext): ENTITIES = _("file remotes") HREF = "file_file_remote_href" ID_PREFIX = "remotes_file_file" - CAPABILITIES = {"roles": [PluginRequirement("file", specifier=">=1.11.0")]} - NEEDS_PLUGINS = [PluginRequirement("file", specifier=">=1.6.0")] + CAPABILITIES = {"roles": []} + NEEDS_PLUGINS = [PluginRequirement("file")] class PulpFileGitRemoteContext(PulpRemoteContext): @@ -153,7 +143,7 @@ class PulpFileGitRemoteContext(PulpRemoteContext): class PulpFileRepositoryVersionContext(PulpRepositoryVersionContext): HREF = "file_file_repository_version_href" ID_PREFIX = "repositories_file_file_versions" - NEEDS_PLUGINS = [PluginRequirement("file", specifier=">=1.6.0")] + NEEDS_PLUGINS = [PluginRequirement("file")] class PulpFileRepositoryContext(PulpRepositoryContext): @@ -165,15 +155,9 @@ class PulpFileRepositoryContext(PulpRepositoryContext): ID_PREFIX = "repositories_file_file" VERSION_CONTEXT = PulpFileRepositoryVersionContext CAPABILITIES = { - "sync": [PluginRequirement("file")], - "pulpexport": [PluginRequirement("file")], - "roles": [PluginRequirement("file", specifier=">=1.11.0")], + "sync": [], + "pulpexport": [], + "roles": [], } NULLABLES = PulpRepositoryContext.NULLABLES | {"manifest", "remote"} - NEEDS_PLUGINS = [PluginRequirement("file", specifier=">=1.6.0")] - - def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: - body = super().preprocess_entity(body, partial=partial) - if "autopublish" in body: - self.pulp_ctx.needs_plugin(PluginRequirement("file", specifier=">=1.7.0")) - return body + NEEDS_PLUGINS = [PluginRequirement("file")] diff --git a/pulp-glue/src/pulp_glue/python/context.py b/pulp-glue/src/pulp_glue/python/context.py index 5b309d368..dd86f663b 100644 --- a/pulp-glue/src/pulp_glue/python/context.py +++ b/pulp-glue/src/pulp_glue/python/context.py @@ -72,11 +72,10 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En self.pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.6.0")) if "version" in body: self.pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.21.0")) - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.16.0")): - if "repository" in body and "publication" not in body: - body["publication"] = None - if "repository" not in body and "publication" in body: - body["repository"] = None + if "repository" in body and "publication" not in body: + body["publication"] = None + if "repository" not in body and "publication" in body: + body["repository"] = None version = body.pop("version", None) if version is not None: diff --git a/pulp-glue/src/pulp_glue/rpm/context.py b/pulp-glue/src/pulp_glue/rpm/context.py index 87516d7f6..2c15e205e 100644 --- a/pulp-glue/src/pulp_glue/rpm/context.py +++ b/pulp-glue/src/pulp_glue/rpm/context.py @@ -82,11 +82,10 @@ class PulpRpmDistributionContext(PulpDistributionContext): def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) - if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.16.0")): - if "repository" in body and "publication" not in body: - body["publication"] = None - if "repository" not in body and "publication" in body: - body["repository"] = None + if "repository" in body and "publication" not in body: + body["publication"] = None + if "repository" not in body and "publication" in body: + body["repository"] = None version = body.pop("version", None) if version is not None: diff --git a/pulp-glue/tests/test_api_quirks.py b/pulp-glue/tests/test_api_quirks.py index 26b763459..f01aca30f 100644 --- a/pulp-glue/tests/test_api_quirks.py +++ b/pulp-glue/tests/test_api_quirks.py @@ -16,11 +16,7 @@ def test_api_quirks_idempotent(pulp_ctx: PulpContext) -> None: """ assert { "patch_content_in_query_filters", - "patch_field_select_filters", - "patch_file_acs_refresh_request_body", - "patch_upstream_pulp_replicate_request_body", "patch_python_remote_includes_excludes", - "patch_ordering_filters", "patch_rpm_copy_scheme", } <= {quirk[1].__name__ for quirk in _REGISTERED_API_SPEC_QUIRKS} diff --git a/src/pulp_cli/generic.py b/src/pulp_cli/generic.py index 391210943..36718c313 100644 --- a/src/pulp_cli/generic.py +++ b/src/pulp_cli/generic.py @@ -1376,7 +1376,6 @@ def _type_callback(ctx: click.Context, param: click.Parameter, value: str | None retained_versions_option = pulp_option( "--retain-repo-versions", - needs_plugins=[PluginRequirement("core", specifier=">=3.13.0")], help=_("Number of repository versions to keep."), type=int_or_empty, ) diff --git a/src/pulpcore/cli/container/distribution.py b/src/pulpcore/cli/container/distribution.py index 34ab08b0a..8b271b748 100644 --- a/src/pulpcore/cli/container/distribution.py +++ b/src/pulpcore/cli/container/distribution.py @@ -103,7 +103,6 @@ def update( distribution: EntityDefinition = distribution_ctx.entity body: EntityDefinition = {} - if private is not None: body["private"] = private if base_path is not None: diff --git a/src/pulpcore/cli/core/distribution.py b/src/pulpcore/cli/core/distribution.py index e6a95c2a3..b4cd8f304 100644 --- a/src/pulpcore/cli/core/distribution.py +++ b/src/pulpcore/cli/core/distribution.py @@ -1,6 +1,6 @@ import click -from pulp_glue.common.context import PluginRequirement, PulpDistributionContext +from pulp_glue.common.context import PulpDistributionContext from pulp_cli.generic import ( PulpCLIContext, @@ -21,7 +21,6 @@ def distribution(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None: Please look for the plugin specific distribution commands for more detailed actions. i.e. 'pulp file distribution <...>' """ - pulp_ctx.needs_plugin(PluginRequirement("core", specifier=">=3.19.0")) ctx.obj = PulpDistributionContext(pulp_ctx) diff --git a/src/pulpcore/cli/core/generic.py b/src/pulpcore/cli/core/generic.py index 24e8d7201..b11c90b85 100644 --- a/src/pulpcore/cli/core/generic.py +++ b/src/pulpcore/cli/core/generic.py @@ -3,7 +3,7 @@ import click -from pulp_glue.common.context import DATETIME_FORMATS, PluginRequirement, PulpEntityContext +from pulp_glue.common.context import DATETIME_FORMATS, PulpEntityContext from pulp_glue.common.i18n import get_translation from pulp_glue.core.context import PulpTaskContext, PulpWorkerContext @@ -61,7 +61,6 @@ def __call__(self, ctx: click.Context, param: click.Parameter, value: str | None "--cid", "logging_cid__contains", help=_("List only tasks with this correlation id."), - needs_plugins=[PluginRequirement("core", specifier=">=3.14.0")], ), click.option( "--state", diff --git a/src/pulpcore/cli/core/group.py b/src/pulpcore/cli/core/group.py index c04a875b3..d777fc6f4 100644 --- a/src/pulpcore/cli/core/group.py +++ b/src/pulpcore/cli/core/group.py @@ -1,13 +1,10 @@ import click -from pulp_glue.common.context import PluginRequirement, PulpEntityContext +from pulp_glue.common.context import PulpEntityContext from pulp_glue.common.i18n import get_translation from pulp_glue.core.context import ( PulpDomainContext, PulpGroupContext, - PulpGroupModelPermissionContext, - PulpGroupObjectPermissionContext, - PulpGroupPermissionContext, PulpGroupRoleContext, PulpGroupUserContext, PulpUserContext, @@ -36,19 +33,6 @@ pass_group_context = click.make_pass_decorator(PulpGroupContext) -def _object_callback(ctx: click.Context, param: click.Parameter, value: str) -> str: - entity_ctx = ctx.find_object(PulpGroupPermissionContext) - assert entity_ctx is not None - if value is not None: - if isinstance(entity_ctx, PulpGroupObjectPermissionContext): - entity_ctx.entity = {"obj": value} - else: - raise click.ClickException(_("This type of Permission does not have an object.")) - elif isinstance(entity_ctx, PulpGroupObjectPermissionContext): - raise click.ClickException(_("This type of Permission needs an object.")) - return value - - def _object_required_callback(ctx: click.Context, param: click.Parameter, value: str) -> str: # Ensure --object is specified with "" when --domain is not being used if value is None: @@ -78,7 +62,6 @@ def _object_required_grouprole_lookup_callback( "core:domain": PulpDomainContext, }, "help": _("Domain the role is applied in"), - "needs_plugins": (PluginRequirement("core", specifier=">=3.23"),), } domain_option = resource_option("--domain", **domain_field_options) domain_group_lookup_option = resource_option( @@ -103,78 +86,7 @@ def group(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None: group.add_command(show_command(decorators=lookup_options)) group.add_command(destroy_command(decorators=lookup_options)) group.add_command(create_command(decorators=create_options)) -group.add_command( - role_command( - decorators=lookup_options, - needs_plugins=[PluginRequirement("core", specifier=">=3.17.0")], - ) -) - - -@group.group(needs_plugins=[PluginRequirement("core", specifier="<3.20.0")]) -@click.option( - "-t", - "--type", - "perm_type", - type=click.Choice(["model", "object"], case_sensitive=False), - default="model", -) -@pass_group_context -@pass_pulp_context -@click.pass_context -def permission( - ctx: click.Context, - pulp_ctx: PulpCLIContext, - group_ctx: PulpGroupContext, - /, - perm_type: str, -) -> None: - if perm_type == "model": - ctx.obj = PulpGroupModelPermissionContext(pulp_ctx, group_ctx) - elif perm_type == "object": - ctx.obj = PulpGroupObjectPermissionContext(pulp_ctx, group_ctx) - else: - raise NotImplementedError() - - -permission.add_command( - list_command( - help=_("Show a list of the permissioons granted to a group."), - decorators=[group_option], - ) -) - - -@permission.command(name="add", help=_("Grant a permission to the group.")) -@group_option -@click.option("--permission", required=True) -@click.option("--object", "obj", callback=_object_callback) -@pass_entity_context -def add_permission(entity_ctx: PulpEntityContext, /, permission: str, obj: str | None) -> None: - assert isinstance(entity_ctx, PulpGroupPermissionContext) - - body = {"permission": permission} - if obj: - body["obj"] = obj - entity_ctx.create(body=body) - - -permission.add_command( - destroy_command( - name="remove", - help=_("Revoke a permission from the group."), - decorators=[ - group_option, - click.option( - "--permission", - required=True, - callback=lookup_callback("permission", PulpGroupPermissionContext), - expose_value=False, - ), - click.option("--object", callback=_object_callback, expose_value=False), - ], - ) -) +group.add_command(role_command(decorators=lookup_options)) @group.group() diff --git a/src/pulpcore/cli/core/orphan.py b/src/pulpcore/cli/core/orphan.py index 1cdd0b0a6..4c1686eaa 100644 --- a/src/pulpcore/cli/core/orphan.py +++ b/src/pulpcore/cli/core/orphan.py @@ -2,7 +2,7 @@ import click -from pulp_glue.common.context import PluginRequirement, PulpViewSetContext +from pulp_glue.common.context import PulpViewSetContext from pulp_glue.common.i18n import get_translation from pulp_glue.core.context import PulpOrphanContext @@ -36,7 +36,6 @@ def orphan(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None: "--content-hrefs", help=_("List of specific Contents to delete if they are orphans"), callback=load_json_callback, - needs_plugins=[PluginRequirement("core", specifier=">=3.14.0")], ) @pulp_option( "--protection-time", @@ -46,7 +45,6 @@ def orphan(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None: "How long in minutes Pulp should hold orphan Content and Artifacts before becoming" " candidates for cleanup task" ), - needs_plugins=[PluginRequirement("core", specifier=">=3.15.0")], ) @pass_view_set_context @pass_pulp_context diff --git a/src/pulpcore/cli/core/publication.py b/src/pulpcore/cli/core/publication.py index 1ea923efd..1640146bf 100644 --- a/src/pulpcore/cli/core/publication.py +++ b/src/pulpcore/cli/core/publication.py @@ -1,7 +1,6 @@ import click from pulp_glue.common.context import ( - PluginRequirement, PulpPublicationContext, PulpRepositoryContext, ) @@ -18,7 +17,6 @@ repository_option = resource_option( "--repository", context_table=PulpRepositoryContext.TYPE_REGISTRY, - needs_plugins=[PluginRequirement("core", specifier=">=3.20.0")], ) diff --git a/src/pulpcore/cli/core/task.py b/src/pulpcore/cli/core/task.py index 88c172ea2..b62f052f2 100644 --- a/src/pulpcore/cli/core/task.py +++ b/src/pulpcore/cli/core/task.py @@ -7,7 +7,6 @@ from pulp_glue.common.context import ( DATETIME_FORMATS, - PluginRequirement, PulpEntityContext, ) from pulp_glue.common.exceptions import PulpException @@ -70,7 +69,6 @@ def task(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None: "reserved_resources__in", multiple=True, help=_("Href of a resource reserved by the task. May be specified multiple times."), - needs_plugins=[PluginRequirement("core", specifier=">=3.22.0")], ), pulp_option( "--exclusive-resource", @@ -85,7 +83,6 @@ def task(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None: "Href of a resource reserved exclusively by the task." " May be specified multiple times." ), - needs_plugins=[PluginRequirement("core", specifier=">=3.22.0")], ), pulp_option( "--shared-resource", @@ -97,18 +94,12 @@ def task(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None: "shared_resources__in", multiple=True, help=_("Href of a resource shared by the task. May be specified multiple times."), - needs_plugins=[PluginRequirement("core", specifier=">=3.22.0")], ), ] ) ) task.add_command(destroy_command(decorators=[href_option, uuid_option])) -task.add_command( - role_command( - decorators=[href_option, uuid_option], - needs_plugins=[PluginRequirement("core", specifier=">=3.17.0")], - ) -) +task.add_command(role_command(decorators=[href_option, uuid_option])) @task.command() diff --git a/src/pulpcore/cli/core/user.py b/src/pulpcore/cli/core/user.py index 820831080..db215941f 100644 --- a/src/pulpcore/cli/core/user.py +++ b/src/pulpcore/cli/core/user.py @@ -1,6 +1,6 @@ import click -from pulp_glue.common.context import PluginRequirement, PulpEntityContext +from pulp_glue.common.context import PulpEntityContext from pulp_glue.common.i18n import get_translation from pulp_glue.core.context import PulpDomainContext, PulpUserContext, PulpUserRoleContext @@ -44,8 +44,6 @@ def _object_required_userrole_lookup_callback( return userrole_lookup_callback(ctx, param, value) -req_core_3_17 = PluginRequirement("core", specifier=">=3.17.0") - username_option = pulp_option( "--username", help=_("Username of the {entity}"), @@ -59,7 +57,6 @@ def _object_required_userrole_lookup_callback( "core:domain": PulpDomainContext, }, "help": _("Domain the role is applied in"), - "needs_plugins": (PluginRequirement("core", specifier=">=3.23"),), } domain_option = resource_option("--domain", **domain_field_options) domain_user_lookup_option = resource_option( @@ -99,11 +96,9 @@ def user(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None: user.add_command(list_command()) user.add_command(show_command(decorators=lookup_options)) -user.add_command(create_command(decorators=create_options, needs_plugins=[req_core_3_17])) -user.add_command( - update_command(decorators=lookup_options + update_options, needs_plugins=[req_core_3_17]) -) -user.add_command(destroy_command(decorators=lookup_options, needs_plugins=[req_core_3_17])) +user.add_command(create_command(decorators=create_options)) +user.add_command(update_command(decorators=lookup_options + update_options)) +user.add_command(destroy_command(decorators=lookup_options)) @user.group(name="role-assignment") @@ -113,7 +108,6 @@ def user(ctx: click.Context, pulp_ctx: PulpCLIContext, /) -> None: def role(ctx: click.Context, pulp_ctx: PulpCLIContext, user_ctx: PulpEntityContext, /) -> None: assert isinstance(user_ctx, PulpUserContext) - pulp_ctx.needs_plugin(req_core_3_17) ctx.obj = PulpUserRoleContext(pulp_ctx, user_ctx) diff --git a/src/pulpcore/cli/file/repository.py b/src/pulpcore/cli/file/repository.py index b923c43d5..ba2c3d9cd 100644 --- a/src/pulpcore/cli/file/repository.py +++ b/src/pulpcore/cli/file/repository.py @@ -5,7 +5,6 @@ from pulp_glue.common.context import ( EntityFieldDefinition, - PluginRequirement, PulpRemoteContext, PulpRepositoryContext, ) @@ -102,11 +101,7 @@ def repository() -> None: click.option("--description"), remote_option, click.option("--manifest"), - pulp_option( - "--autopublish/--no-autopublish", - needs_plugins=[PluginRequirement("file", specifier=">=1.7.0")], - default=None, - ), + pulp_option("--autopublish/--no-autopublish", default=None), retained_versions_option, retain_checkpoints_option, pulp_labels_option, diff --git a/tests/scripts/pulp_ansible/test_content.sh b/tests/scripts/pulp_ansible/test_content.sh index 83414def9..24b691e1b 100755 --- a/tests/scripts/pulp_ansible/test_content.sh +++ b/tests/scripts/pulp_ansible/test_content.sh @@ -72,11 +72,8 @@ expect_succ pulp ansible repository content --type "role" add --repository "cli_ expect_succ pulp ansible repository content --type "role" list --repository "cli_test_ansible_content_repository" --version 2 test "$(echo "$OUTPUT" | jq -r length)" -eq "1" -if pulp debug has-plugin --name "core" --specifier ">=3.11.0" -then - expect_succ pulp ansible repository content list --repository "cli_test_ansible_content_repository" --version 2 --all-types - test "$(echo "$OUTPUT" | jq -r length)" -eq "2" -fi +expect_succ pulp ansible repository content list --repository "cli_test_ansible_content_repository" --version 2 --all-types +test "$(echo "$OUTPUT" | jq -r length)" -eq "2" expect_succ pulp ansible repository content remove --repository "cli_test_ansible_content_repository" --href "$content_href" expect_succ pulp ansible repository content remove --repository "cli_test_ansible_content_repository" --href "$content2_href" diff --git a/tests/scripts/pulp_file/test_distribution.sh b/tests/scripts/pulp_file/test_distribution.sh index e1fe3bc2e..6ec7fcbaf 100755 --- a/tests/scripts/pulp_file/test_distribution.sh +++ b/tests/scripts/pulp_file/test_distribution.sh @@ -38,12 +38,9 @@ expect_succ pulp file distribution update \ --publication "$PUBLICATION_HREF" \ --content-guard "" -if pulp debug has-plugin --name "file" --specifier ">=1.7.0" -then - expect_succ pulp file distribution update \ - --distribution "cli_test_file_distro" \ - --repository "cli_test_file_distribution_repository" -fi +expect_succ pulp file distribution update \ + --distribution "cli_test_file_distro" \ + --repository "cli_test_file_distribution_repository" expect_succ pulp file distribution list --base-path "cli_test_file_distro" test "$(echo "$OUTPUT" | jq -r length)" -eq 1 diff --git a/tests/scripts/pulp_file/test_publication.sh b/tests/scripts/pulp_file/test_publication.sh index 3fe693bd8..1b6ce09ec 100755 --- a/tests/scripts/pulp_file/test_publication.sh +++ b/tests/scripts/pulp_file/test_publication.sh @@ -22,11 +22,8 @@ PUBLICATION_HREF="$(echo "$OUTPUT" | jq -r .pulp_href)" expect_succ pulp file publication destroy --href "$PUBLICATION_HREF" expect_succ pulp file publication create --repository "cli_test_file_publication_repository" --version 0 PUBLICATION_HREF="$(echo "$OUTPUT" | jq -r .pulp_href)" -if pulp debug has-plugin --name "core" --specifier ">=3.20.0" -then - expect_succ pulp file publication list --repository "cli_test_file_publication_repository" - test "$(echo "$OUTPUT" | jq -r length)" -eq 1 - expect_succ pulp publication list --repository "file:file:cli_test_file_publication_repository" - test "$(echo "$OUTPUT" | jq -r length)" -eq 1 -fi +expect_succ pulp file publication list --repository "cli_test_file_publication_repository" +test "$(echo "$OUTPUT" | jq -r length)" -eq 1 +expect_succ pulp publication list --repository "file:file:cli_test_file_publication_repository" +test "$(echo "$OUTPUT" | jq -r length)" -eq 1 expect_succ pulp file publication destroy --href "$PUBLICATION_HREF" diff --git a/tests/scripts/pulp_file/test_repository.sh b/tests/scripts/pulp_file/test_repository.sh index 5f035542e..eed38568c 100755 --- a/tests/scripts/pulp_file/test_repository.sh +++ b/tests/scripts/pulp_file/test_repository.sh @@ -53,17 +53,11 @@ then test "$(echo "$OUTPUT" | jq -r '.retain_checkpoints')" = "null" fi -if pulp debug has-plugin --name "file" --specifier ">=1.7.0" -then - expect_succ pulp file repository update --repository "cli_test_file_repo" --manifest "manifest.csv" +expect_succ pulp file repository update --repository "cli_test_file_repo" --manifest "manifest.csv" - if pulp debug has-plugin --name "file" --specifier ">=1.12.0" - then - expect_succ pulp file repository update --repository "cli_test_file_repo" --manifest "" - expect_succ pulp file repository show --repository "cli_test_file_repo" - test "$(echo "$OUTPUT" | jq -r '.manifest')" = "null" - fi -fi +expect_succ pulp file repository update --repository "cli_test_file_repo" --manifest "" +expect_succ pulp file repository show --repository "cli_test_file_repo" +test "$(echo "$OUTPUT" | jq -r '.manifest')" = "null" expect_succ pulp repository list test "$(echo "$OUTPUT" | jq -r '.|length')" != "0" diff --git a/tests/scripts/pulpcore/test_content_guards.sh b/tests/scripts/pulpcore/test_content_guards.sh index 3169a125c..d9c196175 100755 --- a/tests/scripts/pulpcore/test_content_guards.sh +++ b/tests/scripts/pulpcore/test_content_guards.sh @@ -28,21 +28,15 @@ expect_succ pulp content-guard rbac show --name "cli_test_rbac_guard" test "$(echo "$OUTPUT" | jq -r '.users' | jq -r length)" -eq "0" test "$(echo "$OUTPUT" | jq -r '.groups' | jq -r length)" -eq "0" -if pulp debug has-plugin --name "core" --specifier ">=3.39.0" -then - # Header content guard - expect_succ pulp content-guard header create --name "cli_test_header_guard" --header-name "to" --header-value "ken" - if pulp debug has-plugin --name "core" --specifier ">=3.43.0" - then - # Composite content guard - expect_succ pulp content-guard composite create --name "cli_test_composite_guard" --guard "rbac:cli_test_rbac_guard" --guard "header:cli_test_header_guard" - test "$(echo "$OUTPUT" | jq -r '.guards' | jq -r length)" -eq "2" - expect_succ pulp content-guard composite update --name "cli_test_composite_guard" --guard "rbac:cli_test_rbac_guard" --description "Updated composite guard" - expect_succ pulp content-guard composite show --name "cli_test_composite_guard" - test "$(echo "$OUTPUT" | jq -r '.guards' | jq -r length)" -eq "1" - expect_succ pulp content-guard composite destroy --name "cli_test_composite_guard" - fi - expect_succ pulp content-guard header destroy --name "cli_test_header_guard" -fi +# Header content guard +expect_succ pulp content-guard header create --name "cli_test_header_guard" --header-name "to" --header-value "ken" +# Composite content guard +expect_succ pulp content-guard composite create --name "cli_test_composite_guard" --guard "rbac:cli_test_rbac_guard" --guard "header:cli_test_header_guard" +test "$(echo "$OUTPUT" | jq -r '.guards' | jq -r length)" -eq "2" +expect_succ pulp content-guard composite update --name "cli_test_composite_guard" --guard "rbac:cli_test_rbac_guard" --description "Updated composite guard" +expect_succ pulp content-guard composite show --name "cli_test_composite_guard" +test "$(echo "$OUTPUT" | jq -r '.guards' | jq -r length)" -eq "1" +expect_succ pulp content-guard composite destroy --name "cli_test_composite_guard" +expect_succ pulp content-guard header destroy --name "cli_test_header_guard" expect_succ pulp content-guard rbac destroy --name "cli_test_rbac_guard" diff --git a/tests/scripts/pulpcore/test_task.sh b/tests/scripts/pulpcore/test_task.sh index 4b5d74769..d139b7c93 100755 --- a/tests/scripts/pulpcore/test_task.sh +++ b/tests/scripts/pulpcore/test_task.sh @@ -28,25 +28,21 @@ expect_succ pulp file remote create --name "cli_test_core_task_large_remote" --u expect_succ pulp file repository create --name "cli_test_core_task_repository" --remote "cli_test_core_task_remote" repository_href="$(echo "$OUTPUT" | jq -r '.pulp_href')" -# Test canceling a task introduced in 3.12, but not reliable in 3.18 -if pulp debug has-plugin --name "core" --specifier ">=3.21.0" +expect_succ pulp --background file repository sync --name "cli_test_core_task_repository" --remote "cli_test_core_task_large_remote" +task="$(echo "$ERROUTPUT" | grep -E -o "${PULP_API_ROOT}([-_a-zA-Z0-9]+/)?api/v3/tasks/[-[:xdigit:]]*/")" +if expect_succ pulp task cancel --href "$task" then - expect_succ pulp --background file repository sync --name "cli_test_core_task_repository" --remote "cli_test_core_task_large_remote" - task="$(echo "$ERROUTPUT" | grep -E -o "${PULP_API_ROOT}([-_a-zA-Z0-9]+/)?api/v3/tasks/[-[:xdigit:]]*/")" - if expect_succ pulp task cancel --href "$task" - then - expect_succ pulp task list --name $sync_task --state canceled - expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq $((count + 1)) - expect_succ pulp task show --href "$task" - expect_succ test "$(echo "$OUTPUT" | jq -r '.state')" = "canceled" - else - expect_succ pulp task list --name $sync_task --state canceled - expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq $((count + 0)) - expect_succ pulp task show --href "$task" - expect_succ test "$(echo "$OUTPUT" | jq -r '.state')" = "completed" - fi - expected_repo_task_count=$((expected_repo_task_count + 1)) + expect_succ pulp task list --name $sync_task --state canceled + expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq $((count + 1)) + expect_succ pulp task show --href "$task" + expect_succ test "$(echo "$OUTPUT" | jq -r '.state')" = "canceled" +else + expect_succ pulp task list --name $sync_task --state canceled + expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq $((count + 0)) + expect_succ pulp task show --href "$task" + expect_succ test "$(echo "$OUTPUT" | jq -r '.state')" = "completed" fi +expected_repo_task_count=$((expected_repo_task_count + 1)) expect_fail pulp --dry-run task cancel --all @@ -76,23 +72,17 @@ then expect_succ test -f "task_profile-pulp_file.app.tasks.synchronizing.synchronize-${task_uuid}/memory_profile" fi -if pulp debug has-plugin --name "core" --specifier ">=3.22.0" -then - # New style task resource filters - expect_succ pulp task list --reserved-resource-in "$repository_href" --reserved-resource-in "$remote_href" - expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 1 - expect_succ pulp task list --reserved-resource "$repository_href" - expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 2 - expect_succ pulp task list --exclusive-resource "$repository_href" - expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 2 - expect_succ pulp task list --exclusive-resource "$remote_href" - expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 0 - expect_succ pulp task list --shared-resource "$remote_href" - expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 1 -else - expect_succ pulp task list --reserved-resource "$repository_href" - expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq "$expected_repo_task_count" -fi +# New style task resource filters +expect_succ pulp task list --reserved-resource-in "$repository_href" --reserved-resource-in "$remote_href" +expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 1 +expect_succ pulp task list --reserved-resource "$repository_href" +expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 2 +expect_succ pulp task list --exclusive-resource "$repository_href" +expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 2 +expect_succ pulp task list --exclusive-resource "$remote_href" +expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 0 +expect_succ pulp task list --shared-resource "$remote_href" +expect_succ test "$(echo "$OUTPUT" | jq -r length)" -eq 1 expect_fail pulp task list --state=cannotwork expect_succ pulp task list --state=COmPLetED diff --git a/tests/scripts/test_debug.sh b/tests/scripts/test_debug.sh index 889705c4b..4948078a2 100755 --- a/tests/scripts/test_debug.sh +++ b/tests/scripts/test_debug.sh @@ -5,7 +5,7 @@ set -eu . "$(dirname "$(realpath "$0")")"/config.source expect_succ pulp debug has-cli-plugin --name "common" --specifier ">=0.24.0" -expect_succ pulp debug has-plugin --name "core" --specifier "<4.0" +expect_succ pulp debug has-plugin --name "core" --specifier "<99.0" expect_succ pulp debug openapi spec expect_succ pulp debug openapi operation-ids expect_succ pulp debug openapi operation --id tasks_list diff --git a/tests/test_prn_unit.py b/tests/test_prn_regex.py similarity index 100% rename from tests/test_prn_unit.py rename to tests/test_prn_regex.py From 1dfa4d5793e5cedabb6c8c54c3dcb18d1e3f81e6 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Wed, 29 Jul 2026 15:10:06 +0200 Subject: [PATCH 2/2] Drop workarounds for plugins old branches --- .../pulp-glue/+cleanup_3.49_plugins.removal | 2 + pulp-glue/src/pulp_glue/ansible/context.py | 37 ++-- pulp-glue/src/pulp_glue/container/context.py | 38 ++-- pulp-glue/src/pulp_glue/python/context.py | 43 +--- pulp-glue/src/pulp_glue/rpm/context.py | 196 +++--------------- pulp-glue/tests/test_api_quirks.py | 1 - src/pulp_cli/generic.py | 4 +- src/pulpcore/cli/ansible/distribution.py | 4 - src/pulpcore/cli/python/__init__.py | 9 +- src/pulpcore/cli/python/distribution.py | 2 - src/pulpcore/cli/python/remote.py | 3 - src/pulpcore/cli/python/repository.py | 1 - src/pulpcore/cli/rpm/content.py | 7 - src/pulpcore/cli/rpm/publication.py | 3 - src/pulpcore/cli/rpm/repository.py | 15 -- 15 files changed, 75 insertions(+), 290 deletions(-) create mode 100644 CHANGES/pulp-glue/+cleanup_3.49_plugins.removal diff --git a/CHANGES/pulp-glue/+cleanup_3.49_plugins.removal b/CHANGES/pulp-glue/+cleanup_3.49_plugins.removal new file mode 100644 index 000000000..5b014c75f --- /dev/null +++ b/CHANGES/pulp-glue/+cleanup_3.49_plugins.removal @@ -0,0 +1,2 @@ +Dropped workarounds for plugins no longer maintained branches. +(`ansible < 0.21`; `container < 2.19`; `python < 3.11`; `rpm < 3.26`) diff --git a/pulp-glue/src/pulp_glue/ansible/context.py b/pulp-glue/src/pulp_glue/ansible/context.py index 27c09eb61..c5c994f27 100644 --- a/pulp-glue/src/pulp_glue/ansible/context.py +++ b/pulp-glue/src/pulp_glue/ansible/context.py @@ -23,8 +23,8 @@ class PulpAnsibleCollectionVersionContext(PulpContentContext): HREF = "ansible_collection_version_href" ID_PREFIX = "content_ansible_collection_versions" UPLOAD_ID: t.ClassVar[str] = "upload_collection" - NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.7.0")] - CAPABILITIES = {"upload": [PluginRequirement("ansible", specifier=">=0.16.0")]} + NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.21.0")] + CAPABILITIES = {"upload": []} def upload(self, file: t.IO[bytes], **kwargs: t.Any) -> t.Any: # type:ignore repository: PulpRepositoryContext | None = kwargs.pop("repository", None) @@ -46,7 +46,7 @@ class PulpAnsibleRoleContext(PulpContentContext): ENTITIES = _("ansible roles") HREF = "ansible_role_href" ID_PREFIX = "content_ansible_roles" - NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.7.0")] + NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.21.0")] class PulpAnsibleCollectionVersionSignatureContext(PulpContentContext): @@ -56,20 +56,7 @@ class PulpAnsibleCollectionVersionSignatureContext(PulpContentContext): ENTITIES = _("ansible collection version signatures") HREF = _("ansible_collection_version_signature_href") ID_PREFIX = "content_ansible_collection_signatures" - NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.12.0")] - - def create( - self, - body: EntityDefinition, - parameters: t.Mapping[str, t.Any] | None = None, - non_blocking: bool = False, - ) -> t.Any: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "ansible", specifier=">=0.13.0", feature=_("collection version creation") - ) - ) - return super().create(body=body, parameters=parameters, non_blocking=non_blocking) + NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.21.0")] class PulpAnsibleDistributionContext(PulpDistributionContext): @@ -79,7 +66,7 @@ class PulpAnsibleDistributionContext(PulpDistributionContext): ENTITIES = _("ansible distributions") HREF = "ansible_ansible_distribution_href" ID_PREFIX = "distributions_ansible_ansible" - NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.7.0")] + NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.21.0")] def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) @@ -98,7 +85,7 @@ class PulpAnsibleRoleRemoteContext(PulpRemoteContext): HREF = "ansible_role_remote_href" ID_PREFIX = "remotes_ansible_role" HREF_PATTERN = r"remotes/(?Pansible)/(?Prole)/" - NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.7.0")] + NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.21.0")] class PulpAnsibleGitRemoteContext(PulpRemoteContext): @@ -109,7 +96,7 @@ class PulpAnsibleGitRemoteContext(PulpRemoteContext): HREF = "ansible_git_remote_href" ID_PREFIX = "remotes_ansible_git" HREF_PATTERN = r"remotes/(?Pansible)/(?Pgit)/" - NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.7.0")] + NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.21.0")] class PulpAnsibleCollectionRemoteContext(PulpRemoteContext): @@ -120,7 +107,7 @@ class PulpAnsibleCollectionRemoteContext(PulpRemoteContext): HREF = "ansible_collection_remote_href" ID_PREFIX = "remotes_ansible_collection" HREF_PATTERN = r"remotes/(?Pansible)/(?Pcollection)/" - NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.7.0")] + NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.21.0")] def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) @@ -132,7 +119,7 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En class PulpAnsibleRepositoryVersionContext(PulpRepositoryVersionContext): HREF = "ansible_ansible_repository_version_href" ID_PREFIX = "repositories_ansible_ansible_versions" - NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.7.0")] + NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.21.0")] class PulpAnsibleRepositoryContext(PulpRepositoryContext): @@ -144,8 +131,8 @@ class PulpAnsibleRepositoryContext(PulpRepositoryContext): ENTITIES = _("ansible repositories") VERSION_CONTEXT = PulpAnsibleRepositoryVersionContext CAPABILITIES = { - "sync": [PluginRequirement("ansible")], - "pulpexport": [PluginRequirement("ansible")], + "sync": [], + "pulpexport": [], } NULLABLES = PulpRepositoryContext.NULLABLES | {"gpgkey"} - NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.7.0")] + NEEDS_PLUGINS = [PluginRequirement("ansible", specifier=">=0.21.0")] diff --git a/pulp-glue/src/pulp_glue/container/context.py b/pulp-glue/src/pulp_glue/container/context.py index 0ec92885e..4367c707e 100644 --- a/pulp-glue/src/pulp_glue/container/context.py +++ b/pulp-glue/src/pulp_glue/container/context.py @@ -23,7 +23,7 @@ class PulpContainerBlobContext(PulpContentContext): ENTITIES = _("container blobs") HREF = "container_blob_href" ID_PREFIX = "content_container_blobs" - NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.3.0")] + NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.19.0")] class PulpContainerManifestContext(PulpContentContext): @@ -33,7 +33,7 @@ class PulpContainerManifestContext(PulpContentContext): ENTITIES = _("container manifests") HREF = "container_manifest_href" ID_PREFIX = "content_container_manifests" - NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.3.0")] + NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.19.0")] class PulpContainerTagContext(PulpContentContext): @@ -43,7 +43,7 @@ class PulpContainerTagContext(PulpContentContext): ENTITIES = _("container tags") HREF = "container_tag_href" ID_PREFIX = "content_container_tags" - NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.3.0")] + NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.19.0")] def find(self, **kwargs: t.Any) -> t.Any: if "digest" in kwargs and isinstance(kwargs["digest"], str): @@ -57,8 +57,8 @@ class PulpContainerNamespaceContext(PulpEntityContext): HREF = "container_container_namespace_href" ID_PREFIX = "pulp_container_namespaces" HREF_PATTERN = r"(?Ppulp_container)/(?Pnamespaces)/" - NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.3.0")] - CAPABILITIES = {"roles": [PluginRequirement("container", specifier=">=2.11.0")]} + NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.19.0")] + CAPABILITIES = {"roles": []} class PulpContainerDistributionContext(PulpDistributionContext): @@ -68,8 +68,8 @@ class PulpContainerDistributionContext(PulpDistributionContext): ENTITIES = _("container distributions") HREF = "container_container_distribution_href" ID_PREFIX = "distributions_container_container" - NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.3.0")] - CAPABILITIES = {"roles": [PluginRequirement("container", specifier=">=2.11.0")]} + NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.19.0")] + CAPABILITIES = {"roles": []} def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) @@ -88,24 +88,24 @@ class PulpContainerRemoteContext(PulpRemoteContext): HREF = "container_container_remote_href" ID_PREFIX = "remotes_container_container" NULLABLES = PulpRemoteContext.NULLABLES | {"include_tags", "exclude_tags"} - NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.3.0")] - CAPABILITIES = {"roles": [PluginRequirement("container", specifier=">=2.11.0")]} + NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.19.0")] + CAPABILITIES = {"roles": []} class PulpContainerRepositoryVersionContext(PulpRepositoryVersionContext): HREF = "container_container_repository_version_href" ID_PREFIX = "repositories_container_container_versions" - NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.3.0")] + NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.19.0")] class PulpContainerPushRepositoryVersionContext(PulpRepositoryVersionContext): HREF = "container_container_push_repository_version_href" ID_PREFIX = "repositories_container_container_push_versions" - NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.3.0")] + NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.19.0")] class PulpContainerBaseRepositoryContext(PulpRepositoryContext): - NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.3.0")] + NEEDS_PLUGINS = [PluginRequirement("container", specifier=">=2.19.0")] def tag(self, tag: str, digest: str) -> t.Any: self.needs_capability("tag") @@ -134,10 +134,10 @@ class PulpContainerRepositoryContext(PulpContainerBaseRepositoryContext): VERSION_CONTEXT = PulpContainerRepositoryVersionContext HREF_PATTERN = r"repositories/(?Pcontainer)/(?Pcontainer)/" CAPABILITIES = { - "sync": [PluginRequirement("container")], - "pulpexport": [PluginRequirement("container", specifier=">=2.8.0")], - "tag": [PluginRequirement("container", specifier=">=2.3.0")], - "roles": [PluginRequirement("container", specifier=">=2.11.0")], + "sync": [], + "pulpexport": [], + "tag": [], + "roles": [], } def modify( @@ -187,9 +187,9 @@ class PulpContainerPushRepositoryContext(PulpContainerBaseRepositoryContext): VERSION_CONTEXT = PulpContainerPushRepositoryVersionContext HREF_PATTERN = r"repositories/(?Pcontainer)/(?Pcontainer-push)/" CAPABILITIES = { - "tag": [PluginRequirement("container", specifier=">=2.3.0")], - "roles": [PluginRequirement("container", specifier=">=2.11.0")], - "remove": [PluginRequirement("container", specifier=">=2.4.0")], + "tag": [], + "roles": [], + "remove": [], } def remove_image(self, digest: str) -> t.Any: diff --git a/pulp-glue/src/pulp_glue/python/context.py b/pulp-glue/src/pulp_glue/python/context.py index dd86f663b..d1f8dce38 100644 --- a/pulp-glue/src/pulp_glue/python/context.py +++ b/pulp-glue/src/pulp_glue/python/context.py @@ -11,7 +11,6 @@ PulpRemoteContext, PulpRepositoryContext, PulpRepositoryVersionContext, - api_spec_quirk, ) from pulp_glue.common.exceptions import PulpException from pulp_glue.common.i18n import get_translation @@ -20,20 +19,6 @@ _ = translation.gettext -@api_spec_quirk(PluginRequirement("python", specifier="<3.9.0")) -def patch_python_remote_includes_excludes(api_spec: t.Any) -> t.Any: - python_remote_serializer = api_spec["components"]["schemas"]["python.PythonRemote"] - patched_python_remote_serializer = api_spec["components"]["schemas"][ - "Patchedpython.PythonRemote" - ] - for prop in ("includes", "excludes"): - python_remote_serializer["properties"][prop]["type"] = "array" - python_remote_serializer["properties"][prop]["items"] = {"type": "string"} - patched_python_remote_serializer["properties"][prop]["type"] = "array" - patched_python_remote_serializer["properties"][prop]["items"] = {"type": "string"} - return api_spec - - class PulpPythonContentContext(PulpContentContext): PLUGIN = "python" RESOURCE_TYPE = "package" @@ -41,7 +26,7 @@ class PulpPythonContentContext(PulpContentContext): ENTITIES = _("python packages") HREF = "python_python_package_content_href" ID_PREFIX = "content_python_packages" - NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.1.0")] + NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.11.0")] CAPABILITIES = {"upload": []} @@ -62,14 +47,10 @@ class PulpPythonDistributionContext(PulpDistributionContext): ENTITIES = _("python distributions") HREF = "python_python_distribution_href" ID_PREFIX = "distributions_python_pypi" - NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.1.0")] + NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.11.0")] def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) - if "allow_uploads" in body: - self.pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.4.0")) - if "remote" in body: - self.pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.6.0")) if "version" in body: self.pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.21.0")) if "repository" in body and "publication" not in body: @@ -106,7 +87,7 @@ class PulpPythonPublicationContext(PulpPublicationContext): ENTITIES = _("python publications") HREF = "python_python_publication_href" ID_PREFIX = "publications_python_pypi" - NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.1.0")] + NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.11.0")] def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) @@ -124,19 +105,13 @@ class PulpPythonRemoteContext(PulpRemoteContext): ENTITIES = _("python remotes") HREF = "python_python_remote_href" ID_PREFIX = "remotes_python_python" - NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.1.0")] - - def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: - body = super().preprocess_entity(body, partial=partial) - if "keep_latest_packages" in body or "package_types" in body or "exclude_platforms" in body: - self.pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.2.0")) - return body + NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.11.0")] class PulpPythonRepositoryVersionContext(PulpRepositoryVersionContext): HREF = "python_python_repository_version_href" ID_PREFIX = "repositories_python_python_versions" - NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.1.0")] + NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.11.0")] CAPABILITIES = {"scan": [PluginRequirement("python", specifier=">=3.21.0")]} @@ -149,16 +124,14 @@ class PulpPythonRepositoryContext(PulpRepositoryContext): ID_PREFIX = "repositories_python_python" VERSION_CONTEXT = PulpPythonRepositoryVersionContext CAPABILITIES = { - "sync": [PluginRequirement("python")], - "pulpexport": [PluginRequirement("python", specifier=">=3.11.0")], + "sync": [], + "pulpexport": [], "repair_metadata": [PluginRequirement("python", specifier=">=3.26.0")], } - NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.1.0")] + NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.11.0")] def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) - if "autopublish" in body: - self.pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.3.0")) if "allow_package_substitution" in body: self.pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.28.0")) return body diff --git a/pulp-glue/src/pulp_glue/rpm/context.py b/pulp-glue/src/pulp_glue/rpm/context.py index 2c15e205e..b2ec8c0e6 100644 --- a/pulp-glue/src/pulp_glue/rpm/context.py +++ b/pulp-glue/src/pulp_glue/rpm/context.py @@ -1,7 +1,6 @@ import typing as t from pulp_glue.common.context import ( - BATCH_SIZE, EntityDefinition, PluginRequirement, PulpACSContext, @@ -22,7 +21,7 @@ _ = translation.gettext -@api_spec_quirk(PluginRequirement("rpm", specifier=">=3.3.0")) +@api_spec_quirk(PluginRequirement("rpm")) # TODO fix this upstream and add the version here. def patch_rpm_copy_scheme(api_spec: t.Any) -> t.Any: path, operation = next( ((k, v["post"]) for k, v in api_spec["paths"].items() if k.endswith("/api/v3/rpm/copy/")) @@ -53,13 +52,13 @@ class PulpRpmACSContext(PulpACSContext): ENTITIES = _("rpm ACSes") HREF = "rpm_rpm_alternate_content_source_href" ID_PREFIX = "acs_rpm_rpm" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.18.0")] - CAPABILITIES = {"roles": [PluginRequirement("rpm", specifier=">=3.19.0")]} + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] + CAPABILITIES = {"roles": []} class PulpRpmCompsXmlContext(PulpEntityContext): UPLOAD_COMPS_ID: t.ClassVar[str] = "rpm_comps_upload" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.17.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] def upload_comps(self, file: t.IO[bytes], repo_href: str | None, replace: bool | None) -> t.Any: self.pulp_ctx.echo(_("Uploading file {filename}").format(filename=file.name), err=True) @@ -77,8 +76,8 @@ class PulpRpmDistributionContext(PulpDistributionContext): ENTITIES = _("rpm distributions") HREF = "rpm_rpm_distribution_href" ID_PREFIX = "distributions_rpm_rpm" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] - CAPABILITIES = {"roles": [PluginRequirement("rpm", specifier=">=3.19.0")]} + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] + CAPABILITIES = {"roles": []} def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) @@ -103,16 +102,6 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En ): body["repository_version"] = None - if body.get("generate_repo_config") is False: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", - specifier=">=3.23.0", - feature=_("configuring the generation of the config.repo file"), - ) - ) - elif self.pulp_ctx.has_plugin(PluginRequirement("rpm", specifier="<3.23.0")): - body.pop("generate_repo_config", None) return body @@ -123,43 +112,9 @@ class PulpRpmPackageContext(PulpContentContext): ENTITIES = "rpm packages" HREF = "rpm_package_href" ID_PREFIX = "content_rpm_packages" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] CAPABILITIES = {"upload": []} - def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: - body = super().preprocess_entity(body, partial=partial) - if partial is False and body.get("relative_path") is None: - self.pulp_ctx.needs_plugin(PluginRequirement("rpm", specifier=">=3.18.0")) - return body - - def list_iterator( - self, - parameters: dict[str, t.Any] | None = None, - offset: int = 0, - batch_size: int = BATCH_SIZE, - stats: dict[str, t.Any] | None = None, - ) -> t.Iterator[t.Any]: - contains_startswith = [ - "name__contains", - "name__startswith", - "release__contains", - "release__startswith", - "arch__contains", - "arch__startswith", - ] - if parameters is not None and any( - v for k, v in parameters.items() if k in contains_startswith - ): - self.pulp_ctx.needs_plugin( - PluginRequirement("rpm", specifier=">=3.20.0", feature=_("substring filters")) - ) - return super().list_iterator( - parameters=parameters, - offset=offset, - batch_size=batch_size, - stats=stats, - ) - def upload( self, file: t.IO[bytes], @@ -186,9 +141,7 @@ def upload( self._prepare_upload(body, file, chunk_size) - if repository is None and self.pulp_ctx.has_plugin( - PluginRequirement("rpm", specifier=">=3.32.5") - ): + if repository is None: # "Synchronous upload" return self.call("upload", body=body) @@ -204,7 +157,7 @@ class PulpRpmAdvisoryContext(PulpContentContext): ENTITIES = "rpm advisories" HREF = "rpm_update_record_href" ID_PREFIX = "content_rpm_advisories" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] class PulpRpmDistributionTreeContext(PulpContentContext): @@ -214,7 +167,7 @@ class PulpRpmDistributionTreeContext(PulpContentContext): ENTITIES = "rpm distribution trees" HREF = "rpm_distribution_tree_href" ID_PREFIX = "content_rpm_distribution_trees" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] class PulpRpmModulemdDefaultsContext(PulpContentContext): @@ -224,7 +177,7 @@ class PulpRpmModulemdDefaultsContext(PulpContentContext): ENTITIES = "rpm modulemd defaults" HREF = "rpm_modulemd_defaults_href" ID_PREFIX = "content_rpm_modulemd_defaults" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] class PulpRpmModulemdContext(PulpContentContext): @@ -234,7 +187,7 @@ class PulpRpmModulemdContext(PulpContentContext): ENTITIES = "rpm modulemds" HREF = "rpm_modulemd_href" ID_PREFIX = "content_rpm_modulemds" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] class PulpRpmPackageCategoryContext(PulpContentContext): @@ -244,7 +197,7 @@ class PulpRpmPackageCategoryContext(PulpContentContext): ENTITIES = "rpm package categories" HREF = "rpm_package_category_href" ID_PREFIX = "content_rpm_packagecategories" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] class PulpRpmPackageEnvironmentContext(PulpContentContext): @@ -254,7 +207,7 @@ class PulpRpmPackageEnvironmentContext(PulpContentContext): ENTITIES = "rpm package environments" HREF = "rpm_package_environment_href" ID_PREFIX = "content_rpm_packageenvironments" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] class PulpRpmPackageGroupContext(PulpContentContext): @@ -264,7 +217,7 @@ class PulpRpmPackageGroupContext(PulpContentContext): ENTITIES = "rpm package groups" HREF = "rpm_package_group_href" ID_PREFIX = "content_rpm_packagegroups" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] class PulpRpmPackageLangpacksContext(PulpContentContext): @@ -274,7 +227,7 @@ class PulpRpmPackageLangpacksContext(PulpContentContext): ENTITIES = "rpm package langpacks" HREF = "rpm_package_langpacks_href" ID_PREFIX = "content_rpm_packagelangpacks" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] class PulpRpmRepoMetadataFileContext(PulpContentContext): @@ -284,7 +237,7 @@ class PulpRpmRepoMetadataFileContext(PulpContentContext): ENTITIES = "rpm repo metadata files" HREF = "rpm_repo_metadata_file_href" ID_PREFIX = "content_rpm_repo_metadata_files" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] class PulpRpmPublicationContext(PulpPublicationContext): @@ -294,8 +247,8 @@ class PulpRpmPublicationContext(PulpPublicationContext): ENTITIES = _("rpm publications") HREF = "rpm_rpm_publication_href" ID_PREFIX = "publications_rpm_rpm" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] - CAPABILITIES = {"roles": [PluginRequirement("rpm", specifier=">=3.19.0")]} + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] + CAPABILITIES = {"roles": []} def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) @@ -303,28 +256,8 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En if version is not None: repository_href = body.pop("repository") body["repository_version"] = f"{repository_href}versions/{version}/" - if "repo_config" in body: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", - specifier=">=3.24.0", - feature=_("customization of the config.repo file"), - ) - ) - if "sqlite_metadata" in body: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", - specifier=">=3.25.0", - inverted=True, - feature=_("sqlite_metadata generation"), - ) - ) - if "metadata_checksum_type" in body or "package_checksum_type" in body: - metadata_checksum_type = body.get("metadata_checksum_type") - package_checksum_type = body.get("metadata_checksum_type") - disallowed_checksums = {"md5", "sha1", "sha224"} + if "metadata_checksum_type" in body or "package_checksum_type" in body: self.pulp_ctx.needs_plugin( PluginRequirement( "rpm", @@ -334,18 +267,6 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En ) ) - if metadata_checksum_type and metadata_checksum_type in disallowed_checksums: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", specifier=">=3.25.0", inverted=True, feature=_("weak checksums") - ) - ) - if package_checksum_type and package_checksum_type in disallowed_checksums: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", specifier=">=3.25.0", inverted=True, feature=_("weak checksums") - ) - ) if "repo_gpgcheck" in body or "gpgcheck" in body: self.pulp_ctx.needs_plugin( PluginRequirement( @@ -367,8 +288,8 @@ class PulpRpmRemoteContext(PulpRemoteContext): HREF = "rpm_rpm_remote_href" ID_PREFIX = "remotes_rpm_rpm" NULLABLES = PulpRemoteContext.NULLABLES | {"sles_auth_token"} - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] - CAPABILITIES = {"roles": [PluginRequirement("rpm", specifier=">=3.19.0")]} + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] + CAPABILITIES = {"roles": []} class PulpUlnRemoteContext(PulpRemoteContext): @@ -379,14 +300,14 @@ class PulpUlnRemoteContext(PulpRemoteContext): HREF = "rpm_uln_remote_href" ID_PREFIX = "remotes_rpm_uln" NULLABLES = PulpRemoteContext.NULLABLES | {"uln-server-base-url"} - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.12.0")] - CAPABILITIES = {"roles": [PluginRequirement("rpm", specifier=">=3.19.0")]} + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] + CAPABILITIES = {"roles": []} class PulpRpmRepositoryVersionContext(PulpRepositoryVersionContext): HREF = "rpm_rpm_repository_version_href" ID_PREFIX = "repositories_rpm_rpm_versions" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] CAPABILITIES = {"scan": [PluginRequirement("rpm", specifier=">=3.38.0")]} @@ -401,37 +322,14 @@ class PulpRpmRepositoryContext(PulpRepositoryContext): CAPABILITIES = { "sync": [], "pulpexport": [], - "roles": [PluginRequirement("rpm", specifier=">=3.19.0")], + "roles": [], } - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] NULLABLES = PulpRepositoryContext.NULLABLES | {"osv_config"} def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: body = super().preprocess_entity(body, partial=partial) - if "autopublish" in body: - self.pulp_ctx.needs_plugin(PluginRequirement("rpm", specifier=">=3.12.0")) - if "repo_config" in body: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", - specifier=">=3.24.0", - feature=_("customization of the config.repo file"), - ) - ) - if "sqlite_metadata" in body: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", - specifier=">=3.25.0", - inverted=True, - feature=_("sqlite_metadata generation"), - ) - ) if "metadata_checksum_type" in body or "package_checksum_type" in body: - metadata_checksum_type = body.get("metadata_checksum_type") - package_checksum_type = body.get("metadata_checksum_type") - disallowed_checksums = {"md5", "sha1", "sha224"} - self.pulp_ctx.needs_plugin( PluginRequirement( "rpm", @@ -440,29 +338,6 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En feature=_("package_checksum_type/metadata_checksum_type"), ) ) - - if metadata_checksum_type and metadata_checksum_type in disallowed_checksums: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", specifier=">=3.25.0", inverted=True, feature=_("weak checksums") - ) - ) - if package_checksum_type and package_checksum_type in disallowed_checksums: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", specifier=">=3.25.0", inverted=True, feature=_("weak checksums") - ) - ) - - if "checksum_type" in body: - self.pulp_ctx.needs_plugin( - PluginRequirement( - "rpm", - specifier=">=3.25.0", - feature=_("checksum_type"), - ) - ) - if "repo_gpgcheck" in body or "gpgcheck" in body: self.pulp_ctx.needs_plugin( PluginRequirement( @@ -475,23 +350,10 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En return body - def sync(self, body: EntityDefinition | None = None) -> t.Any: - if body: - if body.get("optimize") is not None: - self.pulp_ctx.needs_plugin(PluginRequirement("rpm", specifier=">=3.3.0")) - if body.get("sync_policy") is not None: - self.pulp_ctx.needs_plugin(PluginRequirement("rpm", specifier=">=3.16.0")) - if "treeinfo" in body.get("skip_types", ""): - self.pulp_ctx.needs_plugin( - PluginRequirement("rpm", specifier=">=3.18.10", feature="--skip-type treeinfo") - ) - - return super().sync(body) - class PulpRpmPruneContext(PulpViewSetContext): ID_PREFIX: t.ClassVar[str] = "rpm_prune" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.27.0.dev")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.27.0")] def prune_packages( self, @@ -509,7 +371,7 @@ def prune_packages( class PulpRpmCopyContext(PulpViewSetContext): COPY_ID: t.ClassVar[str] = "rpm_copy_content" - NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.3.0")] + NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.26.0")] def copy( self, diff --git a/pulp-glue/tests/test_api_quirks.py b/pulp-glue/tests/test_api_quirks.py index f01aca30f..1793cc64f 100644 --- a/pulp-glue/tests/test_api_quirks.py +++ b/pulp-glue/tests/test_api_quirks.py @@ -16,7 +16,6 @@ def test_api_quirks_idempotent(pulp_ctx: PulpContext) -> None: """ assert { "patch_content_in_query_filters", - "patch_python_remote_includes_excludes", "patch_rpm_copy_scheme", } <= {quirk[1].__name__ for quirk in _REGISTERED_API_SPEC_QUIRKS} diff --git a/src/pulp_cli/generic.py b/src/pulp_cli/generic.py index 36718c313..feeecc875 100644 --- a/src/pulp_cli/generic.py +++ b/src/pulp_cli/generic.py @@ -839,9 +839,9 @@ def pulp_option( ``` pulp_option( "--name", - needs_plugins=[PluginRequirement("rpm", specifier=">=3.12.0")], + needs_plugins=[PluginRequirement("catdog", specifier=">=1.2.3")], help=_("Name of {entity}"), - allowed_with_contexts=(PulpRpmRepositoryContext,), + allowed_with_contexts=(PulpCatDogRepositoryContext,), ) ``` """ diff --git a/src/pulpcore/cli/ansible/distribution.py b/src/pulpcore/cli/ansible/distribution.py index f20144840..e9d7092e3 100644 --- a/src/pulpcore/cli/ansible/distribution.py +++ b/src/pulpcore/cli/ansible/distribution.py @@ -4,7 +4,6 @@ from pulp_glue.common.context import ( EntityDefinition, EntityFieldDefinition, - PluginRequirement, PulpEntityContext, ) from pulp_glue.common.i18n import get_translation @@ -69,9 +68,6 @@ def distribution() -> None: distribution.add_command( label_command( decorators=nested_lookup_options, - need_plugins=[ - PluginRequirement("ansible", specifier=">=0.8.0"), - ], ) ) diff --git a/src/pulpcore/cli/python/__init__.py b/src/pulpcore/cli/python/__init__.py index c22ed0451..7002a0227 100644 --- a/src/pulpcore/cli/python/__init__.py +++ b/src/pulpcore/cli/python/__init__.py @@ -2,9 +2,7 @@ import click -from pulp_glue.common.context import PluginRequirement - -from pulp_cli.generic import PulpCLIContext, pass_pulp_context, pulp_group +from pulp_cli.generic import pulp_group from pulpcore.cli.python.content import content from pulpcore.cli.python.distribution import distribution from pulpcore.cli.python.publication import publication @@ -13,9 +11,8 @@ @pulp_group(name="python") -@pass_pulp_context -def python_group(pulp_ctx: PulpCLIContext, /) -> None: - pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.1.0")) +def python_group() -> None: + pass def mount(main: click.Group, **kwargs: t.Any) -> None: diff --git a/src/pulpcore/cli/python/distribution.py b/src/pulpcore/cli/python/distribution.py index 94fb8a0ba..e2818f971 100644 --- a/src/pulpcore/cli/python/distribution.py +++ b/src/pulpcore/cli/python/distribution.py @@ -75,7 +75,6 @@ def distribution() -> None: content_guard_option, pulp_option( "--allow-uploads/--block-uploads", - needs_plugins=[PluginRequirement("python", specifier=">=3.4.0")], default=None, ), resource_option( @@ -83,7 +82,6 @@ def distribution() -> None: default_plugin="python", default_type="python", context_table={"python:python": PulpPythonRemoteContext}, - needs_plugins=[PluginRequirement("python", specifier=">=3.6.0")], href_pattern=PulpPythonRemoteContext.HREF_PATTERN, ), pulp_labels_option, diff --git a/src/pulpcore/cli/python/remote.py b/src/pulpcore/cli/python/remote.py index 8b25854a0..33c98a49f 100644 --- a/src/pulpcore/cli/python/remote.py +++ b/src/pulpcore/cli/python/remote.py @@ -73,17 +73,14 @@ def remote() -> None: pulp_option( "--keep-latest-packages", type=int, - needs_plugins=[PluginRequirement("python", specifier=">=3.2.0")], ), pulp_option( "--package-types", callback=load_json_callback, - needs_plugins=[PluginRequirement("python", specifier=">=3.2.0")], ), pulp_option( "--exclude-platforms", callback=load_json_callback, - needs_plugins=[PluginRequirement("python", specifier=">=3.2.0")], ), pulp_option( "--provenance/--no-provenance", diff --git a/src/pulpcore/cli/python/repository.py b/src/pulpcore/cli/python/repository.py index ce9a6d9e6..f8d958f66 100644 --- a/src/pulpcore/cli/python/repository.py +++ b/src/pulpcore/cli/python/repository.py @@ -80,7 +80,6 @@ def repository() -> None: remote_option, pulp_option( "--autopublish/--no-autopublish", - needs_plugins=[PluginRequirement("python", specifier=">=3.3.0")], default=None, ), pulp_option( diff --git a/src/pulpcore/cli/rpm/content.py b/src/pulpcore/cli/rpm/content.py index a710a06ed..9e5c5369f 100644 --- a/src/pulpcore/cli/rpm/content.py +++ b/src/pulpcore/cli/rpm/content.py @@ -121,21 +121,18 @@ def content() -> None: "--arch-contains", "arch__contains", allowed_with_contexts=(PulpRpmPackageContext,), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.20.0")], ), pulp_option( "--arch-in", "arch__in", multiple=True, allowed_with_contexts=(PulpRpmPackageContext, PulpRpmModulemdContext), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.20.0")], ), pulp_option("--arch-ne", "arch__ne", allowed_with_contexts=(PulpRpmPackageContext,)), pulp_option( "--arch-startswith", "arch__startswith", allowed_with_contexts=(PulpRpmPackageContext,), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.20.0")], ), pulp_option( "--checksum-type", @@ -194,7 +191,6 @@ def content() -> None: "--name-contains", "name__contains", allowed_with_contexts=(PulpRpmPackageContext,), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.20.0")], ), pulp_option( "--name-in", @@ -211,7 +207,6 @@ def content() -> None: "--name-startswith", "name__startswith", allowed_with_contexts=(PulpRpmPackageContext,), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.20.0")], ), pulp_option("--package-href", allowed_with_contexts=(PulpRpmPackageContext,)), pulp_option("--pkgId", allowed_with_contexts=(PulpRpmPackageContext,)), @@ -226,14 +221,12 @@ def content() -> None: "--release-contains", "release__contains", allowed_with_contexts=(PulpRpmPackageContext,), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.20.0")], ), pulp_option( "--release-in", "release__in", multiple=True, allowed_with_contexts=(PulpRpmPackageContext,), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.20.0")], ), pulp_option("--release-ne", "release__ne", allowed_with_contexts=(PulpRpmPackageContext,)), pulp_option( diff --git a/src/pulpcore/cli/rpm/publication.py b/src/pulpcore/cli/rpm/publication.py index 41b0102c6..f8bfb3675 100644 --- a/src/pulpcore/cli/rpm/publication.py +++ b/src/pulpcore/cli/rpm/publication.py @@ -50,7 +50,6 @@ def publication() -> None: pulp_option( "--repo-config", "repo_config", - needs_plugins=[PluginRequirement("rpm", specifier=">=3.24.0")], help=_( "A JSON dictionary describing config.repo file (or @file containing a JSON dictionary)" ), @@ -62,13 +61,11 @@ def publication() -> None: help=_( "Option specifying the checksum type to use for package and metadata integrity checks." ), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")], ), pulp_option( "--compression-type", type=click.Choice(COMPRESSION_CHOICES, case_sensitive=False), help=_("Option specifying the compression type to use for metadata."), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")], ), pulp_option( "--checkpoint", diff --git a/src/pulpcore/cli/rpm/repository.py b/src/pulpcore/cli/rpm/repository.py index c19d89837..4b5bb929c 100644 --- a/src/pulpcore/cli/rpm/repository.py +++ b/src/pulpcore/cli/rpm/repository.py @@ -158,13 +158,11 @@ def repository() -> None: help=_( "Option specifying the checksum type to use for package and metadata integrity checks." ), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")], ), pulp_option( "--compression-type", type=click.Choice(COMPRESSION_CHOICES, case_sensitive=False), help=_("Option specifying the compression type to use for metadata."), - needs_plugins=[PluginRequirement("rpm", specifier=">=3.25.0")], ), pulp_option( "--gpgcheck", @@ -186,18 +184,8 @@ def repository() -> None: ), needs_plugins=[PluginRequirement("rpm", specifier="<3.30.0")], ), - pulp_option( - "--sqlite-metadata/--no-sqlite-metadata", - default=None, - help=_( - """DEPRECATED: An option specifying whether Pulp should generate SQLite metadata. - Unavailable for pulp_rpm>=3.25.0""" - ), - needs_plugins=[PluginRequirement("rpm", specifier="<3.25.0")], - ), pulp_option( "--autopublish/--no-autopublish", - needs_plugins=[PluginRequirement("rpm", specifier=">=3.12.0")], default=None, ), retained_versions_option, @@ -206,7 +194,6 @@ def repository() -> None: pulp_option( "--repo-config", "repo_config", - needs_plugins=[PluginRequirement("rpm", specifier=">=3.24.0")], help=_( "A JSON dictionary describing config.repo file (or @file containing a JSON dictionary)" ), @@ -264,7 +251,6 @@ def repository() -> None: "--optimize/--no-optimize", default=None, help="Whether or not to optimize sync.", - needs_plugins=[PluginRequirement("rpm", specifier=">=3.3.0")], ) @click.option( "--skip-type", @@ -285,7 +271,6 @@ def repository() -> None: bit-for-bit identical. 'additive' will retain the existing contents of the repository and add the contents of the repository being synced. """, - needs_plugins=[PluginRequirement("rpm", specifier=">=3.16.0")], ) @pass_repository_context def sync(