Return-Path: X-Original-To: apmail-ambari-dev-archive@www.apache.org Delivered-To: apmail-ambari-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 90743172DE for ; Thu, 19 Nov 2015 14:49:11 +0000 (UTC) Received: (qmail 55899 invoked by uid 500); 19 Nov 2015 14:49:11 -0000 Delivered-To: apmail-ambari-dev-archive@ambari.apache.org Received: (qmail 55865 invoked by uid 500); 19 Nov 2015 14:49:11 -0000 Mailing-List: contact dev-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ambari.apache.org Delivered-To: mailing list dev@ambari.apache.org Received: (qmail 55738 invoked by uid 99); 19 Nov 2015 14:49:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2015 14:49:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 1BE622C1F65 for ; Thu, 19 Nov 2015 14:49:11 +0000 (UTC) Date: Thu, 19 Nov 2015 14:49:11 +0000 (UTC) From: "Sebastian Toader (JIRA)" To: dev@ambari.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AMBARI-7591) ambari-server Should Return Correct System Level Run Code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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)