[ 
https://issues.apache.org/jira/browse/AMBARI-7591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15014742#comment-15014742
 ] 

Hudson commented on AMBARI-7591:
--------------------------------

FAILURE: Integrated in Ambari-branch-2.1 #898 (See 
[https://builds.apache.org/job/Ambari-branch-2.1/898/])
AMBARI-7591 - Ambari-server Should Return Correct System Level Run Code 
(jhurley: 
[http://git-wip-us.apache.org/repos/asf?p=ambari.git&a=commit&h=12f9d0764e43bd11bb06b48312bd226c628a6176])
* ambari-server/src/test/python/TestAmbariServer.py
* ambari-server/src/main/python/ambari-server.py


> ambari-server Should Return Correct System Level Run Code
> ---------------------------------------------------------
>
>                 Key: AMBARI-7591
>                 URL: https://issues.apache.org/jira/browse/AMBARI-7591
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 1.6.1
>         Environment: Redhat 6.5
>            Reporter: Clark Updike
>            Assignee: Sebastian Toader
>            Priority: Minor
>             Fix For: 2.1.3
>
>         Attachments: AMBARI-7591.v1.patch
>
>
> Running {{service ambari-server status}} returns an exit status code of 0 
> even when the service is not running--as demonstrated with some && || 
> conditions:
> {code}
> [ ~]# sudo service ambari-server status && echo "running" || echo "not 
> running"
> Using python  /usr/bin/python2.6
> Ambari-server status
> Ambari Server running
> Found Ambari Server PID: '3653 at: /var/run/ambari-server/ambari-server.pid
> running
> [ ~]# service ambari-server stop
> Using python  /usr/bin/python2.6
> Stopping ambari-server
> Ambari Server stopped
> [ ~]# sudo service ambari-server status && echo "running" || echo "not 
> running"
> Using python  /usr/bin/python2.6
> Ambari-server status
> Ambari Server not running. Stale PID File at: 
> /var/run/ambari-server/ambari-server.pid
> running  #### WHOOPS!
> {code}
> This does not conform with standards:
> http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
> This prevents tools like Saltstack (a configuration management tool) from 
> managing the service since it always thinks it is running.
> A possible fix is to add an exit to line 105 of 
> /etc/rc.d/init.d/ambari-server:
> {code}
> 102   status)
> 103         #echo -e "Ambari-server status"
> 104         $PYTHON /usr/sbin/ambari-server.py $@
> 105         exit
> {code}
> And add a sys.exit(1) to /usr/sbin/ambari-server.py:
> {code}
> 2890   else:
> 2891     print "Ambari Server not running. Stale PID File at: " + PID_DIR + 
> os.sep + PID_NAME
> 2892     sys.exit(1)
> {code}
> Here is the related issue I filed with Saltstack (but it is dispositioned as 
> a documentation issue):
> https://github.com/saltstack/salt/issues/16245#issuecomment-57402182
> Note that ambari-agent does not have this problem (it is implemented 
> correctly):
> {code}
> [ ~]$ sudo service ambari-agent status && echo "running" || echo "not running"
> Found ambari-agent PID: 3156
> ambari-agent running.
> Agent PID at: /var/run/ambari-agent/ambari-agent.pid
> Agent out at: /var/log/ambari-agent/ambari-agent.out
> Agent log at: /var/log/ambari-agent/ambari-agent.log
> running
> [ ~]$ sudo service ambari-agent stop
> Verifying Python version compatibility...
> Using python  /usr/bin/python2.6
> Found ambari-agent PID: 3156
> Stopping ambari-agent
> Removing PID file at /var/run/ambari-agent/ambari-agent.pid
> ambari-agent successfully stopped
> [ ~]$ sudo service ambari-agent status && echo "running" || echo "not running"
> ambari-agent currently not running
> Usage: /usr/sbin/ambari-agent {start|stop|restart|status}
> not running  #### CORRECT
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to