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-22998] Wrong user used to execute the Spark/Livy Server service check #370

Merged
merged 2 commits into from
Feb 16, 2018
Merged

Conversation

rlevas
Copy link
Contributor

@rlevas rlevas commented Feb 15, 2018

What changes were proposed in this pull request?

common-services/SPARK/1.2.1/package/scripts/service_check.py:36

 livy_kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal}; ")
 Execute(livy_kinit_cmd, user=params.livy_user)

Notice the Kerberos identity is for the smoke user, but the exec is for the livy user. This will replace the livy user's interactive Kerberos ticket cache.

This should be 

smoke_user_kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal}; ")
Execute(smoke_user_kinit_cmd, user=params.smoke_user)

Where smoke_user is

smoke_user =  config['configurations']['cluster-env']['smokeuser']

This is similar for SPARK2 as well.

How was this patch tested?

Tested manually with original code to see the issue and then fix the fixed code to see it working properly:

2018-02-15 03:15:04,058 - Using hadoop conf dir: /usr/hdp/2.6.5.0-96/hadoop/conf
2018-02-15 03:15:04,061 - Execute['/usr/bin/kinit -kt /etc/security/keytabs/spark.headless.keytab spark-c1@EXAMPLE.COM; '] {'user': 'spark'}
2018-02-15 03:15:04,085 - Execute['/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa-c1@EXAMPLE.COM; '] {'user': 'ambari-qa'}
2018-02-15 03:15:04,109 - Execute['curl -s -o /dev/null -w'%{http_code}' --negotiate -u: -k http://c6403.ambari.apache.org:18081 | grep 200'] {'logoutput': True, 'tries': 5, 'user': 'spark', 'try_sleep': 3}
200
2018-02-15 03:15:04,356 - Execute['curl -s -o /dev/null -w'%{http_code}' --negotiate -u: -k http://c6402.ambari.apache.org:8999/sessions | grep 200'] {'logoutput': True, 'tries': 3, 'user': 'livy', 'try_sleep': 1}
200

Command completed successfully!

Please review Ambari Contributing Guide before opening a pull request.

Copy link
Contributor

@swagle swagle left a comment

Choose a reason for hiding this comment

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

No unit test changes needed?

@rlevas
Copy link
Contributor Author

rlevas commented Feb 15, 2018

@swagle , @zeroflag .. please recheck. I needed to make a small change to make the original change make sense.

@asfgit
Copy link

asfgit commented Feb 15, 2018

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

@rlevas
Copy link
Contributor Author

rlevas commented Feb 15, 2018

@swagle There appears to be no unit tests for this and since we are trying to get this in quickly, I didn't want to spend the time trying to figure out how to build a Python unit test from scratch.

@asfgit
Copy link

asfgit commented Feb 15, 2018

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

@rlevas
Copy link
Contributor Author

rlevas commented Feb 15, 2018

retest this please

@asfgit
Copy link

asfgit commented Feb 15, 2018

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

@rlevas rlevas merged commit 364b5e5 into apache:branch-2.6 Feb 16, 2018
@rlevas rlevas deleted the AMBARI-22998 branch February 16, 2018 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants