diff --git a/CHANGES/pulp-glue/+nullables.bugfix b/CHANGES/pulp-glue/+nullables.bugfix new file mode 100644 index 000000000..d2622479f --- /dev/null +++ b/CHANGES/pulp-glue/+nullables.bugfix @@ -0,0 +1 @@ +Added remote to the nullable fields of repositories. diff --git a/pulp-glue/pulp_glue/common/context.py b/pulp-glue/pulp_glue/common/context.py index e2a8e6ab4..98a49ff50 100644 --- a/pulp-glue/pulp_glue/common/context.py +++ b/pulp-glue/pulp_glue/common/context.py @@ -1418,7 +1418,7 @@ class PulpRepositoryContext(PulpEntityContext): HREF_PATTERN = r"repositories/(?P[\w\-_]+)/(?P[\w\-_]+)/" ID_PREFIX = "repositories" VERSION_CONTEXT: t.ClassVar[t.Type[PulpRepositoryVersionContext]] = PulpRepositoryVersionContext - NULLABLES = {"description", "retain_repo_versions"} + NULLABLES = {"description", "remote", "retain_repo_versions"} TYPE_REGISTRY: t.Final[t.Dict[str, t.Type["PulpRepositoryContext"]]] = {} def __init_subclass__(cls, **kwargs: t.Any) -> None: diff --git a/pulp-glue/pulp_glue/file/context.py b/pulp-glue/pulp_glue/file/context.py index 60322c304..12c4ccb61 100644 --- a/pulp-glue/pulp_glue/file/context.py +++ b/pulp-glue/pulp_glue/file/context.py @@ -98,7 +98,7 @@ class PulpFilePublicationContext(PulpPublicationContext): HREF = "file_file_publication_href" ID_PREFIX = "publications_file_file" CAPABILITIES = {"roles": [PluginRequirement("file", specifier=">=1.11.0")]} - NULLABLES = {"manifest"} + NULLABLES = PulpPublicationContext.NULLABLES | {"manifest"} NEEDS_PLUGINS = [PluginRequirement("file", specifier=">=1.6.0")] def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: @@ -140,7 +140,7 @@ class PulpFileRepositoryContext(PulpRepositoryContext): "pulpexport": [PluginRequirement("file")], "roles": [PluginRequirement("file", specifier=">=1.11.0")], } - NULLABLES = PulpRepositoryContext.NULLABLES.union({"manifest", "remote"}) + NULLABLES = PulpRepositoryContext.NULLABLES | {"manifest", "remote"} NEEDS_PLUGINS = [PluginRequirement("file", specifier=">=1.6.0")] def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> EntityDefinition: diff --git a/pulp-glue/pulp_glue/rpm/context.py b/pulp-glue/pulp_glue/rpm/context.py index 9188de383..f9b8f0eed 100644 --- a/pulp-glue/pulp_glue/rpm/context.py +++ b/pulp-glue/pulp_glue/rpm/context.py @@ -1,6 +1,7 @@ import typing as t from pulp_glue.common.context import ( + BATCH_SIZE, EntityDefinition, PluginRequirement, PulpACSContext, @@ -123,6 +124,15 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En self.pulp_ctx.needs_plugin(PluginRequirement("rpm", specifier=">=3.18.0")) else: PulpException(_("--relative-path must be provided")) + return body + + def list_iterator( + self, + parameters: t.Optional[t.Dict[str, t.Any]] = None, + offset: int = 0, + batch_size: int = BATCH_SIZE, + stats: t.Optional[t.Dict[str, t.Any]] = None, + ) -> t.Iterator[t.Any]: contains_startswith = [ "name__contains", "name__startswith", @@ -131,11 +141,18 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En "arch__contains", "arch__startswith", ] - if any(k in body for k in contains_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 body + return super().list_iterator( + parameters=parameters, + offset=offset, + batch_size=batch_size, + stats=stats, + ) class PulpRpmAdvisoryContext(PulpContentContext): @@ -307,17 +324,7 @@ class PulpRpmRemoteContext(PulpRemoteContext): ENTITIES = _("rpm remotes") HREF = "rpm_rpm_remote_href" ID_PREFIX = "remotes_rpm_rpm" - NULLABLES = { - "ca_cert", - "client_cert", - "client_key", - "username", - "password", - "proxy_url", - "proxy_username", - "proxy_password", - "sles_auth_token", - } + NULLABLES = PulpRemoteContext.NULLABLES | {"sles_auth_token"} NEEDS_PLUGINS = [PluginRequirement("rpm", specifier=">=3.9.0")] CAPABILITIES = {"roles": [PluginRequirement("rpm", specifier=">=3.19.0")]}