Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-5740

ambari-server setup command does not return correct exit status upon error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5.1
    • 1.6.1
    • None
    • None
    • CentOS 6.4/6.5

    Description

      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] ?
      Customize user account for ambari-server daemon [y/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.

      Attachments

        Issue Links

          Activity

            People

              dmitriusan Dmitry Lysnichenko
              rnettleton Bob Nettleton
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: