Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: fix help #550

Closed
wants to merge 6 commits into from
Closed

install: fix help #550

wants to merge 6 commits into from

Conversation

HonzaCholasta
Copy link
Contributor

@HonzaCholasta HonzaCholasta commented Mar 8, 2017

This PR fixes the known issue in the installer refactoring PR #232 and concludes https://pagure.io/freeipa/issue/6392.

server install: remove duplicate -w option

Remove duplicate -w alias of --admin-password in ipa-server-install and
ipa-replica-install.

install: add missing space in realm_name description

server install: remove duplicate knob definitions

Remove duplicate definitions of knobs already defined in client install.

client install: split off SSSD options into a separate class

Split off SSSD knob definitions from the ClientInstallInterface class into
a new SSSDInstallInterface class.

install CLI: remove magic option groups

Do not automatically create the "basic options" and "uninstall options"
option groups in the CLI code.

install: re-introduce option groups

Re-introduce option groups in ipa-client-install, ipa-server-install and
ipa-replica-install.

https://pagure.io/freeipa/issue/6392

@stlaz stlaz self-assigned this Mar 8, 2017
sensitive=_missing, deprecated=_missing, description=_missing,
group=_missing, cli_names=_missing, cli_deprecated_names=_missing,
cli_metavar=_missing):
if type is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid shadowing of python builtins?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, why not call it e.g. type_ instead of doing _type = type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the Knob attribute name is type. IMHO shadowing would be an issue only if type was called in the function, which is not the case here. type is used as an argument name on numerous occasions in the Python standard library too, so I don't see why it should be an issue here.

Copy link
Contributor

@stlaz stlaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some comments, most are questions or suggestions, if you could please react to them.


permit = knob(
None,
description="disable access rules by default, permit all access.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for nitpicking, could you please keep the casing of the first letter? At least in this new group.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it was cased before, I did not (intentionally) change any of the descriptions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider changing it a small doc fix, similar to PEP-8 fixes for Python. But then again I don't mind this in the end, I would probably ACK this even if you rewrote all the help to Pirate English.

groups = collections.OrderedDict()
groups[None] = basic_group
groups[None] = parser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we want to fail in case index is None now. Since the rest of the list will be of type optparser.OptionGroup, wouldn't it be better if this was None instead of parser?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Group is not guaranteed to be not None, and None does not have .add_option().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see, so this will create some set of basic options. Please, could you add a comment there explaining it so that it's very clear?

sensitive=_missing, deprecated=_missing, description=_missing,
group=_missing, cli_names=_missing, cli_deprecated_names=_missing,
cli_metavar=_missing):
if type is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, why not call it e.g. type_ instead of doing _type = type?

if default is not _missing:
class_dict['default'] = default
if _order is not _missing:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when class_dict is missing the 'order' key? That's one of the reasons why knob and extended_knob came to life but this is getting way too spaghettious for me to decrypt at this stage of development cycle.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be inherited from the base class.



def extend_knob(base, default=_missing, bases=_missing, group=_missing,
**kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shall be at least a short docstring for future humans who try to find out what happened here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

@@ -451,6 +454,7 @@ class ADTrustInstallInterface(ServiceAdminInstallInterface):
description="Add IPA masters to a list of hosts allowed to "
"serve information about users from trusted forests"
)
add_agents = replica_install_only(add_agents)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fixing some kind of a regression? I don't mind if it's fixed in this commit, I would just like to know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a cosmetic fix - the knob was redefined in ServerInstallInterface only to decorate it with replica_install_only, which is a) completely unnecessary b) inconsistent with other component installers.

Jan Cholasta added 6 commits March 13, 2017 08:13
Remove duplicate -w alias of --admin-password in ipa-server-install and
ipa-replica-install.

https://pagure.io/freeipa/issue/6392
Remove duplicate definitions of knobs already defined in client install.

https://pagure.io/freeipa/issue/6392
Split off SSSD knob definitions from the ClientInstallInterface class into
a new SSSDInstallInterface class.

https://pagure.io/freeipa/issue/6392
Do not automatically create the "basic options" and "uninstall options"
option groups in the CLI code.

https://pagure.io/freeipa/issue/6392
Re-introduce option groups in ipa-client-install, ipa-server-install and
ipa-replica-install.

https://pagure.io/freeipa/issue/6392
@stlaz
Copy link
Contributor

stlaz commented Mar 13, 2017

Works like a charm, ACK.

@stlaz stlaz added the ack Pull Request approved, can be merged label Mar 13, 2017
@MartinBasti MartinBasti added the pushed Pull Request has already been pushed label Mar 13, 2017
@MartinBasti
Copy link
Contributor

master:

  • 00f49dd server install: remove duplicate -w option
  • 5efa55c install: add missing space in realm_name description
  • 94f362d server install: remove duplicate knob definitions
  • 1cfe06c client install: split off SSSD options into a separate class
  • 774d8d0 install CLI: remove magic option groups
  • 2fc9fed install: re-introduce option groups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
3 participants