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

Restore the original functionality of env and plugins commands #278

Closed
wants to merge 3 commits into from

Conversation

martbab
Copy link
Contributor

@martbab martbab commented Nov 28, 2016

This reverts commit 1166fbc "Add 'ipa
localenv' subcommand" and instead fixes the command to be executed locally
unless --server option is given.

Note than plugins command fails due to
https://fedorahosted.org/freeipa/ticket/6513 but now at least it fails either
locally or on server-side :).

https://fedorahosted.org/freeipa/ticket/6490

This reverts commit 1166fbc. The proper fix
is to restore pre-thin client behavior of commands inheriting from
LocalOrRemote class.

https://fedorahosted.org/freeipa/ticket/6490
During thin client refactoring, LocalOrRemote class implementation of `run`
method was overriden by default Command implementation during instantiation of
client plugins from schema. This caused these commands to always forward this
request to IPA master.

This patch restores the original behavior: unless `--server` option was
specified, the commands will always print out local config.

https://fedorahosted.org/freeipa/ticket/6490
Make the code moved from `ipaserver/plugins` pep-8 conformant.

https://fedorahosted.org/freeipa/ticket/6490

return dict(
result=result,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this code should rather be in ipalib.plugins

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why should it be in ipalib.plugins? can you explain your reasons better?

Copy link
Contributor

Choose a reason for hiding this comment

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

It was originally a plugin and still keeps plugin-like behavior so I thought it should rather be there but there's no other reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well since these particular classes must behave as both server and client plugins at the same time, you would then have this code copy-pasted in two places. I rather opted to keep implementation in one place and a) registering it on server, and b) overriding it on client.

@@ -26,26 +26,31 @@ class env(LocalOrRemote):
)

takes_options = LocalOrRemote.takes_options + (
Flag('all',
Flag(
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be better to go like this?

Flag('all',
     cli_name='all',
     ...
     )

Otherwise it looks a bit ridiculous as you're saving about 1-2 spaces 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.

If you look at some other newly written plugins (e.g. ipaserver/plugins/server.py) you will se that I have used the option formatting constistent with them and I would rather keep it like that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, alright.

@stlaz
Copy link
Contributor

stlaz commented Dec 2, 2016

env works as expected, plugins seems to fail as expected. ACK.

@stlaz stlaz added the ack Pull Request approved, can be merged label Dec 2, 2016
@martbab martbab added the pushed Pull Request has already been pushed label Dec 2, 2016
@martbab martbab closed this Dec 2, 2016
@martbab martbab deleted the api-env-fixes branch December 16, 2016 14:26
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
2 participants