You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
'pulp domain' leads to a stack trace when a default value for --domain is provided in the config file. #769
When writing 'pulp' in the cli, 'domain' shows as one of the available commands, but entering 'pulp domain (...)' always leads to a Python traceback. Right way to access pulp domain commands is typing 'pulp domains (...)'.
Typing 'pulp domains' shows a valid domain menu, so the problem applies to the top-level help list.
edit:
It's a conflict between --domain and domain and the way click handles default_maps for child contexts. https://click.palletsprojects.com/en/8.1.x/commands/#overriding-defaults: "The default map can be nested arbitrarily for each subcommand:"
Long story short, if you remove the "domain" entry from the config file (that is where the string comes from that it later tries to use as a new default_map), we are fine again.
pulp domains was the original implementation, but that doesn't follow the pulp-cli pattern (command should be singular not plural). domains was left as an alias when we fixed it, but will be removed Real Soon Now.
[michal@fedora Pulp]$ pulp domains
Please use 'domain' instead of 'domains'.
Usage: pulp domains [OPTIONS] COMMAND [ARGS]...
Perform actions on domains.
Options:
--help Show this message and exit.
Commands:
create
destroy
list
role
show
update
[michal@fedora Pulp]$ pulp domain
Traceback (most recent call last):
File "/home/michal/.local/bin/pulp", line 8, in <module>
sys.exit(main())
File "/home/michal/Desktop/Pulp/pulp-cli/pulp_cli/__init__.py", line 33, in main
return _main()
File "/usr/lib/python3.10/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/michal/Desktop/Pulp/pulp-cli/pulpcore/cli/common/generic.py", line 183, in invoke
return super().invoke(ctx)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
File "/usr/lib/python3.10/site-packages/click/core.py", line 914, in make_context
self.parse_args(ctx, args)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1612, in parse_args
echo(ctx.get_help(), color=ctx.color)
File "/usr/lib/python3.10/site-packages/click/core.py", line 693, in get_help
return self.command.get_help(self)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1295, in get_help
self.format_help(ctx, formatter)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1326, in format_help
self.format_options(ctx, formatter)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1523, in format_options
super().format_options(ctx, formatter)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1346, in format_options
rv = param.get_help_record(ctx)
File "/usr/lib/python3.10/site-packages/click/core.py", line 2710, in get_help_record
default_value = self.get_default(ctx, call=False)
File "/usr/lib/python3.10/site-packages/click/core.py", line 2782, in get_default
return super().get_default(ctx, call=call)
File "/usr/lib/python3.10/site-packages/click/core.py", line 2210, in get_default
value = ctx.lookup_default(self.name, call=False) # type: ignore
File "/usr/lib/python3.10/site-packages/click/core.py", line 658, in lookup_default
value = self.default_map.get(name)
AttributeError: 'str' object has no attribute 'get'
changed the title [-]'pulp domains' is misleadingly listed as 'pulp domain' in the help text[/-][+]'pulp domain' leads to a stack trace when a default value for --domain is provided in the config file.[/+]on Aug 11, 2023
Activity
mdellweg commentedon Aug 11, 2023
pulp domainis the proper command.ggainey commentedon Aug 11, 2023
pulp domainswas the original implementation, but that doesn't follow the pulp-cli pattern (command should be singular not plural).domainswas left as an alias when we fixed it, but will be removed Real Soon Now.MichalPysik commentedon Aug 11, 2023
MichalPysik commentedon Aug 11, 2023
^
@ggainey @mdellweg I rebased to the latest cli version and this is still what both me and @lubosmj get.
[-]'pulp domains' is misleadingly listed as 'pulp domain' in the help text[/-][+]'pulp domain' leads to a stack trace when a default value for --domain is provided in the config file.[/+]Fixed crashing pulp domain
Fixed crashing pulp domain
Fixed crashing pulp domain
Fixed crashing pulp domain
Fixed crashing pulp domain
Fixed crashing pulp domain