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

scripts, tests: explicitly set confdir in the rest of server code #301

Closed
wants to merge 1 commit into from
Closed

scripts, tests: explicitly set confdir in the rest of server code #301

wants to merge 1 commit into from

Conversation

HonzaCholasta
Copy link
Contributor

@HonzaCholasta HonzaCholasta commented Dec 2, 2016

Commit 1e6a204 added explicit confdir
setting to api.bootstrap() calls of a randomly selected portion of
server-side scripts and tests. This commit adds it to the rest of
server-side code for consistency.

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

Commit 1e6a204 added explicit confdir
setting to api.bootstrap() calls of a randomly selected portion of
server-side scripts and tests. This commit adds it to the rest of
server-side code for consistency.

https://fedorahosted.org/freeipa/ticket/6389
@tiran tiran self-assigned this Dec 2, 2016
@@ -72,7 +73,7 @@ def main():
sys.exit("Unrecognized action [" + args[0] + "]")
standard_logging_setup(None, debug=options.debug)

api.bootstrap(context='cli', debug=options.debug)
api.bootstrap(context='cli', debug=options.debug, confdir=paths.ETC_IPA)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an ugly old script, therefore this should be in try-except block.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nvm, the script behaves the same in other error cases, disregard the previous comment.

Copy link
Member

Choose a reason for hiding this comment

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

NACK

Same reason as for ipa-compat-manage

@tiran
Copy link
Member

tiran commented Dec 12, 2016

I'll review the patch by the end of the week. Some changes are not required.

@stlaz
Copy link
Contributor

stlaz commented Dec 13, 2016

@tiran I find all the changes actually required. I think ACK is in order unless you spell out those which you think are not necessary.

Copy link
Member

@tiran tiran left a comment

Choose a reason for hiding this comment

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

The bootstrap calls in ipaserver/install should use confdir, most other places do not need specia cases to work.

env._finalize_core(**dict(DEFAULT_CONFIG))

# Initialize the API with the proper debug level
api.bootstrap(context='server', debug=env.debug, log=None) (ref:wsgi-app-bootstrap)
api.bootstrap(context='server', confdir=paths.ETC_IPA,
debug=env.debug, log=None) (ref:wsgi-app-bootstrap)
Copy link
Member

Choose a reason for hiding this comment

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

NACK

Documentation should explain the common case (no confdir override). Users may want to use the IPA_CONFDIR var here. I'm ok with a comment or second example.

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 file should be kept in sync with install/share/wsgi.py. This change does just that, there is no other intention behind it.

api.bootstrap(context='cli',
in_server=True,
debug=options.debug,
confdir=paths.ETC_IPA)
Copy link
Member

Choose a reason for hiding this comment

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

NACK, the script works fine with IPA_CONFDIR. It does neither modify local file nor requires root permission to run.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're still required to enter Directory Manager password which is why I would expect the script not to be influenced by an environment variable.

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 does not matter at all that the script works with IPA_CONFDIR - there is no use case for it and it only introduces additional maintenance burden for us, hence the change.

If you want server scripts to work with IPA_CONFDIR, file a RFE. Until it's implemented, the correct way to handle IPA_CONFDIR in server scripts is not to support it.

Copy link
Member

Choose a reason for hiding this comment

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

I don't agree. There is no additonal maintenance burden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there is - we will have to test this and make sure we don't break it, which is not worth doing for a "feature" nobody wants and will ever use.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

context='cli',
in_server=True,
verbose=options.verbose,
confdir=paths.ETC_IPA,
Copy link
Member

Choose a reason for hiding this comment

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

NACK

Same reason as for ipa-compat-manage

@@ -72,7 +73,7 @@ def main():
sys.exit("Unrecognized action [" + args[0] + "]")
standard_logging_setup(None, debug=options.debug)

api.bootstrap(context='cli', debug=options.debug)
api.bootstrap(context='cli', debug=options.debug, confdir=paths.ETC_IPA)
Copy link
Member

Choose a reason for hiding this comment

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

NACK

Same reason as for ipa-compat-manage

advise_api.bootstrap(in_server=False, context='cli')
advise_api.bootstrap(in_server=False,
context='cli',
confdir=paths.ETC_IPA)
Copy link
Member

Choose a reason for hiding this comment

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

NACK

Same reason as for ipa-compat-manage

@@ -414,7 +415,8 @@ def zone_keypairs(self):
log = ipa_log_manager.root_logger

# IPA framework initialization
ipalib.api.bootstrap(in_server=True, log=None) # no logging to file
# no logging to file
ipalib.api.bootstrap(in_server=True, log=None, confdir=paths.ETC_IPA)
Copy link
Member

Choose a reason for hiding this comment

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

NACK

Same reason as for ipa-compat-manage

This is just some debugging code in if __name__ == '__main__' block. There is no harm to support IPA_CONFDIR

@@ -111,7 +112,7 @@ def test_Backend(self):
# a client-only api. Then we register in the commands and objects
# we need for the test.
myapi = create_api(mode=None)
myapi.bootstrap(context='cli', in_server=True)
myapi.bootstrap(context='cli', in_server=True, confdir=paths.ETC_IPA)
Copy link
Member

Choose a reason for hiding this comment

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

NACK

Tests use their own confdir for testing. Let's handle the env var in the test runner.

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 API object does not use the test confdir. The test runner should be updated in different PR.

test_api.bootstrap(in_server=True, ldap_uri=api.env.ldap_uri)
test_api.bootstrap(in_server=True,
ldap_uri=api.env.ldap_uri,
confdir=paths.ETC_IPA)
Copy link
Member

Choose a reason for hiding this comment

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

NACK

same reason as above

@stlaz
Copy link
Contributor

stlaz commented Feb 22, 2017

This PR implements the stuff that was agreed on in later comments in #280 and actually requested by @pvoborni.
Currently, I do not see the reason why this PR should not be accepted, if IPA_CONFDIR is required in either of these scripts for some reason, we can implement it later and add the justification to it.

@stlaz stlaz added the ack Pull Request approved, can be merged label Feb 22, 2017
@HonzaCholasta HonzaCholasta added the pushed Pull Request has already been pushed label Feb 22, 2017
@HonzaCholasta
Copy link
Contributor Author

@tiran
Copy link
Member

tiran commented Feb 22, 2017

My philosophy is: Don't fix it, if it ain't broken.

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