Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/pulp-glue/+nullables.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added remote to the nullable fields of repositories.
2 changes: 1 addition & 1 deletion pulp-glue/pulp_glue/common/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ class PulpRepositoryContext(PulpEntityContext):
HREF_PATTERN = r"repositories/(?P<plugin>[\w\-_]+)/(?P<resource_type>[\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:
Expand Down
4 changes: 2 additions & 2 deletions pulp-glue/pulp_glue/file/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
33 changes: 20 additions & 13 deletions pulp-glue/pulp_glue/rpm/context.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import typing as t

from pulp_glue.common.context import (
BATCH_SIZE,
EntityDefinition,
PluginRequirement,
PulpACSContext,
Expand Down Expand Up @@ -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",
Expand All @@ -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):
Expand Down Expand Up @@ -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")]}

Expand Down
Loading