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
Conversation
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
| @@ -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) | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
I'll review the patch by the end of the week. Some changes are not required. |
|
@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. |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) | |||
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) | |||
There was a problem hiding this comment.
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) | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
|
This PR implements the stuff that was agreed on in later comments in #280 and actually requested by @pvoborni. |
|
Fixed upstream |
|
My philosophy is: Don't fix it, if it ain't broken. |
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