7 Replies Latest reply on Sep 26, 2012 9:30 AM by Lazar NameToUpdate

    Error code in script to fail a BLpackage job

    Mike Reider

      Hi all, I am trying to run a BLpackage against a Linux box to test whether it has the correct version of various applications installed,


      My BLpackage contains several Ext Commands that look like this,



      Ext Cmd #1

      ###### check installed python version

      function python_ver {

      PY_MATCHES=`python --version 2>&1 | grep ??TARGET.DT.PYTHON_VERSION?? | wc -l`

      if [ ${PY_MATCHES} -lt 1 ] ; then

                  echo "***ERROR***"

          echo "Python version did not match, expected ??TARGET.DT.PYTHON_VERSION??"

           echo "Actual Python version:"

           python --version

      exit 1    ### make the BLdeploy job error out so the user knows that Python version is incorrect


         echo "Python PASSED"

      exit 0   ### version is correct, proceed to next ext. cmd.




      Ext  Cmd #2

      ####### check installed VMWare tools version

      function vmware_ver {

      VMWARE_INSTALLED=`vmstat -V`


      if [ ${VMWARE_VERSION_MATCHES} -lt 1 ]; then

      echo "***ERROR***"

              echo "VMWare version did not match, expected release ??TARGET.DT.VMWARE_RELEASE??"

              echo "Actual version ${VMWARE_INSTALLED}"

      exit 1 


      echo "VMWare PASSED"

      exit 0





      I want the BLPackage to run through each ext command and if the version is incorrect, to throw out an error and continue parsing the next Ext Command.

      For each ext. command, I set the ActionOnFailure to COntinue, and added the exit 1 and exit 0 codes (in bold above) to the script.


      When I run the package, it comes back successful, even though the logs show that the versions are incorrect, but my BLpackage job never fails, so the user running the job from bladelogic has no idea that the versions are incorrect and doesnt see any errors.


      is there any way to make the BL job error out and continue parsing the rest of the external commands? The 'exit 1' code doesnt seem to make it error out, the job completes with a green check mark.