Robert Nettleton created AMBARI-5740:
----------------------------------------

             Summary: ambari-server setup command does not return correct exit 
status upon error
                 Key: AMBARI-5740
                 URL: https://issues.apache.org/jira/browse/AMBARI-5740
             Project: Ambari
          Issue Type: Bug
    Affects Versions: 1.5.1
         Environment: CentOS 6.4/6.5
            Reporter: Robert Nettleton


The exit code of the “ambari-server setup” command does not seem to be correct 
in v1.5.1.  If I setup a VM with this version of Ambari installed, and simulate 
an error condition (the JDK location being invalid), I notice that the error 
code returned by the command always seems to be zero.  This can cause problems 
with any automated scripts that setup ambari-server, since there is no way to 
determine if the setup completed successfully.  

Here’s the output I’m seeing with Ambari 1.5.1:

Log from attempting an ambari setup with an invalid jdk with 1.5.1:

"[root@rwntwo ~]# ambari-server setup -s -j /opt/jdkNotThere
Using python  /usr/bin/python2.6
Setup ambari-server
Checking SELinux...
SELinux status is 'enabled'
SELinux mode is 'enforcing'
Temporarily disabling SELinux
WARNING: SELinux is set to 'permissive' mode and temporarily disabled.
OK to continue [y/n] (y)?
Customize user account for ambari-server daemon [y/n] (n)?
Adjusting ambari-server permissions and ownership...
Checking iptables...
Checking JDK...
ERROR: Exiting with exit code 1.
REASON: Downloading or installing JDK failed: 'Fatal exception: Path to java 
home /opt/jdkNotThere or java binary file does not exists, exit code 1'. 
Exiting.
[root@rwntwo ~]# echo $?
0”

Even though the log claims that the process is returning an exit code of 1, the 
$? variable contains zero.

Since the setup command does not return an error code in this situation, there 
is no way for an external caller to know if the setup has completed 
successfully.  This can cause problems for the HDP integration with OpenStack 
in project Sahara, since the HDP plugin installs and configures an Ambari 
server instance prior to starting up a cluster in the cloud.  If the error code 
is not returned as expected, the plugin cannot detect the failure condition.  




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to