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

[AMBARI-22649] settings library should convert true/false to boolean #419

Conversation

adoroszlai
Copy link
Contributor

What changes were proposed in this pull request?

The settings library for getting clusterSettings and stackSettings should convert literal "true" and "false" values to the Python boolean type to retain backward compatibility with ConfigDictionary:

if value == "true":
value = True
elif value == "false":
value = False
return value

Stack scripts rely on this behavior in a lot of places. One of the most widely used is the security_enabled flag. Without this conversion, scripts would execute the "secure" code path for both "true" and "false" values, since only the empty string is treated as False.

security_enabled = config['configurations']['cluster-env']['security_enabled']

How was this patch tested?

Deployed cluster using blueprint.

Unit test tweaked, passing:

$ mvn -am -pl ambari-server -Del.log=WARN -DfailIfNoTests=false -DskipSurefireTests -Dcheckstyle.skip -Drat.skip -Dpython.test.mask=TestSettings.py test
...
Total run:14
Total errors:0
Total failures:0
OK

@asfgit
Copy link

asfgit commented Feb 21, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ambari-Github-PullRequest-Builder/722/
Test FAILed.
Test FAILured.

@adoroszlai adoroszlai merged commit 52d58cd into apache:branch-feature-AMBARI-14714 Feb 22, 2018
@adoroszlai adoroszlai deleted the AMBARI-22649_settings_library_boolean_conversion branch February 22, 2018 16:01
Copy link
Contributor

@mradha25 mradha25 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants