mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
install CLI: remove magic option groups
Do not automatically create the "basic options" and "uninstall options" option groups in the CLI code. https://pagure.io/freeipa/issue/6392 Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
parent
1cfe06c79e
commit
774d8d0a5d
@ -136,22 +136,22 @@ class ConfigureTool(admintool.AdminTool):
|
|||||||
help="unattended (un)installation never prompts the user",
|
help="unattended (un)installation never prompts the user",
|
||||||
)
|
)
|
||||||
|
|
||||||
basic_group = optparse.OptionGroup(parser, "basic options")
|
|
||||||
|
|
||||||
groups = collections.OrderedDict()
|
groups = collections.OrderedDict()
|
||||||
groups[None] = basic_group
|
# if no group is defined, add the option to the parser top level
|
||||||
|
groups[None] = parser
|
||||||
|
|
||||||
for owner_cls, name in transformed_cls.knobs():
|
for owner_cls, name in transformed_cls.knobs():
|
||||||
knob_cls = getattr(owner_cls, name)
|
knob_cls = getattr(owner_cls, name)
|
||||||
if knob_cls.is_cli_positional() is not positional:
|
if knob_cls.is_cli_positional() is not positional:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
group_cls = owner_cls.group()
|
group_cls = knob_cls.group()
|
||||||
try:
|
try:
|
||||||
opt_group = groups[group_cls]
|
opt_group = groups[group_cls]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
opt_group = groups[group_cls] = optparse.OptionGroup(
|
opt_group = groups[group_cls] = optparse.OptionGroup(
|
||||||
parser, "{0} options".format(group_cls.description))
|
parser, "{0} options".format(group_cls.description))
|
||||||
|
parser.add_option_group(opt_group)
|
||||||
|
|
||||||
knob_type = knob_cls.type
|
knob_type = knob_cls.type
|
||||||
if issubclass(knob_type, list):
|
if issubclass(knob_type, list):
|
||||||
@ -237,9 +237,6 @@ class ConfigureTool(admintool.AdminTool):
|
|||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
for opt_group in groups.values():
|
|
||||||
parser.add_option_group(opt_group)
|
|
||||||
|
|
||||||
super(ConfigureTool, cls).add_options(parser,
|
super(ConfigureTool, cls).add_options(parser,
|
||||||
debug_option=cls.debug_option)
|
debug_option=cls.debug_option)
|
||||||
|
|
||||||
@ -353,8 +350,7 @@ class InstallTool(ConfigureTool):
|
|||||||
super(InstallTool, cls).add_options(parser, positional)
|
super(InstallTool, cls).add_options(parser, positional)
|
||||||
|
|
||||||
if cls.uninstall_kwargs is not None:
|
if cls.uninstall_kwargs is not None:
|
||||||
uninstall_group = optparse.OptionGroup(parser, "uninstall options")
|
parser.add_option(
|
||||||
uninstall_group.add_option(
|
|
||||||
'--uninstall',
|
'--uninstall',
|
||||||
dest='uninstall',
|
dest='uninstall',
|
||||||
default=False,
|
default=False,
|
||||||
@ -362,7 +358,6 @@ class InstallTool(ConfigureTool):
|
|||||||
help=("uninstall an existing installation. The uninstall can "
|
help=("uninstall an existing installation. The uninstall can "
|
||||||
"be run with --unattended option"),
|
"be run with --unattended option"),
|
||||||
)
|
)
|
||||||
parser.add_option_group(uninstall_group)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_command_class(cls, options, args):
|
def get_command_class(cls, options, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user