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
16 changes: 15 additions & 1 deletion pulp_cli/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@
else:
SECRET_STORAGE = True

try:
# Sentinel is introduced in click 8.3.
# We need to use it to identify unset values.
_UNSET = click._utils.Sentinel.UNSET # type: ignore[attr-defined]

def _unset(value: t.Any) -> bool:
return value is _UNSET or value is None or value == () or value == []

except AttributeError:

def _unset(value: t.Any) -> bool:
return value is None or value == () or value == []


translation = get_translation(__package__)
_ = translation.gettext

Expand Down Expand Up @@ -474,7 +488,7 @@ def __init__(
super().__init__(*args, **kwargs)

def process_value(self, ctx: click.Context, value: t.Any) -> t.Any:
if self.needs_plugins and value is not None and value != ():
if self.needs_plugins and not _unset(value):
pulp_ctx = ctx.find_object(PulpCLIContext)
assert pulp_ctx is not None
for plugin_requirement in self.needs_plugins:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ classifiers=[
]
dependencies = [
"pulp-glue==0.37.0.dev",
"click>=8.0.0,<8.3", # Proven to not do semver.
"click>=8.0.0,<8.4", # Proven to not do semver.
"PyYAML>=5.3,<6.1",
"schema>=0.7.5,<0.8",
"tomli>=2.0.0,<2.1;python_version<'3.11'",
Expand Down
Loading