> On Nov. 8, 2016, 1:33 p.m., Robert Levas wrote: > > ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py, > > lines 86-88 > > <https://reviews.apache.org/r/53578/diff/1/?file=1556708#file1556708line86> > > > > If removing `as_user`, does this need to indicate the user to run as? > > Jonathan Hurley wrote: > So, the `as_user` was only for the `only_if`. I'm not changing the > `Execute` itself since that's not the bug here. Since PID is accessible to > the world, then we don't need to run as a user to execute the > `process_id_exists_command` > > Jonathan Hurley wrote: > Since this is a hard kill command, running it using ambari-sudo.sh is > correct: > ```'ambari-sudo.sh kill -9 `cat /var/run/webhcat/webhcat.pid`'```
Great.. thanks for the clarification. - Robert ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/53578/#review155322 ----------------------------------------------------------- On Nov. 8, 2016, 1:04 p.m., Jonathan Hurley wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/53578/ > ----------------------------------------------------------- > > (Updated Nov. 8, 2016, 1:04 p.m.) > > > 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 > >
