-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/53578/
-----------------------------------------------------------
Review request for Ambari, Nate Cole and Robert Levas.
Bugs: AMBARI-18824
https://issues.apache.org/jira/browse/AMBARI-18824
Repository: ambari
Description
-------
There was code added in AMBARI-12695 (later corrected by AMBARI-18684) which
tries to kill WebHCat if it doesn't stop with its own stop command.
Both patches use the {{as_user}} function to wrap the call in a bash login:
```
ps -p `su hcat -l -s /bin/bash -c 'cat /var/run/webhcat/webhcat.pid'`
>/dev/null 2>&1
```
This, however, causes problems where there is a MOTD:
```
ERROR: Process ID list syntax error.
********* simple selection ********* ********* selection by list *********
-A all processes -C by command name
-N negate selection -G by real group ID (supports names)
-a all w/ tty except session leaders -U by real user ID (supports names)
...
```
That's not good - why is it giving us back a bad command syntax? Here's the
reason:
```
[root@ijzs-c229todgsecha-r6-re1-3 ~]# su hcat -l -s /bin/bash -c 'cat
/var/run/webhcat/webhcat.pid'
This is MOTD message :)
25672
```
*The MOTD is messing up the output from commands for the {{hcat}} user. Because
we rely on the error code of {{ps}}, the same non-zero code is used for a bad
command and a missing process ID*.
Since the PID is world-readable, we don't need to run the {{only_if}} checks as
a separate user.
Diffs
-----
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
fc6b933
ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
0880a19
Diff: https://reviews.apache.org/r/53578/diff/
Testing
-------
Tested with non-root agents and a MOTD
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 49.346 s
[INFO] Finished at: 2016-11-08T12:49:12-05:00
[INFO] Final Memory: 20M/439M
[INFO] ------------------------------------------------------------------------
Thanks,
Jonathan Hurley