-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/47729/
-----------------------------------------------------------

Review request for Ambari, Jonathan Hurley, Nate Cole, and Sandor Magyari.


Bugs: AMBARI-16801
    https://issues.apache.org/jira/browse/AMBARI-16801


Repository: ambari


Description
-------

# Error
```
"stderr" : "Traceback (most recent call last):\n  File 
\"/var/lib/ambari-agent/cache/common-services/YARN/2.1.0.2.0/package/scripts/mapred_service_check.py\",
 line 162, in <module>\n    MapReduce2ServiceCheck().execute()\n  File 
\"/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py\",
 line 254, in execute\n    method(env)\n  File 
\"/var/lib/ambari-agent/cache/common-services/YARN/2.1.0.2.0/package/scripts/mapred_service_check.py\",
 line 140, in service_check\n    params.smokeuser_principal, params.hostname, 
params.tmp_dir)\n  File 
\"/usr/lib/python2.6/site-packages/resource_management/libraries/functions/security_commons.py\",
 line 204, in cached_kinit_executor\n    new_cached_exec(key, file_path, 
kinit_path, temp_dir, exec_user, keytab_file, principal, hostname)\n  File 
\"/usr/lib/python2.6/site-packages/resource_management/libraries/functions/security_commons.py\",
 line 225, in new_cached_exec\n    Execute(command, user=exec_user)\n  File 
\"/usr/lib/pyth
 on2.6/site-packages/resource_management/core/base.py\", line 155, in 
__init__\n    self.env.run()\n  File 
\"/usr/lib/python2.6/site-packages/resource_management/core/environment.py\", 
line 160, in run\n    self.run_action(resource, action)\n  File 
\"/usr/lib/python2.6/site-packages/resource_management/core/environment.py\", 
line 124, in run_action\n    provider_action()\n  File 
\"/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py\",
 line 273, in action_run\n    tries=self.resource.tries, 
try_sleep=self.resource.try_sleep)\n  File 
\"/usr/lib/python2.6/site-packages/resource_management/core/shell.py\", line 
70, in inner\n    result = function(command, **kwargs)\n  File 
\"/usr/lib/python2.6/site-packages/resource_management/core/shell.py\", line 
92, in checked_call\n    tries=tries, try_sleep=try_sleep)\n  File 
\"/usr/lib/python2.6/site-packages/resource_management/core/shell.py\", line 
140, in _call_wrapper\n    result = _call(command, **kwargs_copy)\n  File
  \"/usr/lib/python2.6/site-packages/resource_management/core/shell.py\", line 
293, in _call\n    raise 
Fail(err_msg)\nresource_management.core.exceptions.Fail: Execution of 
'/usr/bin/kinit -c /var/lib/ambari-agent/tmp/tmpGyLePc -kt 
/etc/security/keytabs/smokeuser.headless.keytab ambari...@example.com' returned 
1. kinit(v5): Internal credentials cache error when initializing cache 
/var/lib/ambari-agent/tmp/tmpGyLePc",
```

# Cause
The MR service check was incorrectly calling `cached_kinit_executor` which is 
used for internally testing keytab files in service status checks. This found 
an issue where the user executing the check was not able to create the 
temporary ticket cache due to ACLs on the relevant directory and created file - 
created as the user executing ambari-agent, not the specified user. 

# Solution
Ensured the user specified in `cached_kinit_executor` owns the temporary ticket 
cache and correctly kinit-ed in the Map Reduce service check function.


Diffs
-----

  
ambari-common/src/main/python/resource_management/libraries/functions/security_commons.py
 4ce2a5a 
  
ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapred_service_check.py
 02fa57a 
  
ambari-server/src/test/python/stacks/2.0.6/YARN/test_mapreduce2_service_check.py
 eef0faf 

Diff: https://reviews.apache.org/r/47729/diff/


Testing
-------

Manually tested

# Local test results: PASSED

# Jenkins test results: PENDING


Thanks,

Robert Levas

Reply via email to