ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebastian Toader (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AMBARI-7591) ambari-server Should Return Correct System Level Run Code
Date Thu, 19 Nov 2015 14:49:11 GMT

     [ https://issues.apache.org/jira/browse/AMBARI-7591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sebastian Toader updated AMBARI-7591:
-------------------------------------
    Attachment: AMBARI-7591.v1.patch

> 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
>         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)

Mime
View raw message