2 Replies Latest reply on Sep 4, 2014 2:24 PM by richard mcleod

    unable to get BatchJob isByStage to work

    richard mcleod

      Wondering if I'm missing some undocumented pre-requisite here... I cannot get the following set of commands to work in an nsh script

       

      blcli_execute BatchJob isByStage

      blcli_storeenv byStage

       

      Output=

      Error09/04/2014 13:38:27Command execution failed. java.lang.Throwable: Command Execution Failed: java.lang.Throwable: Command Execution Failed
      Error09/04/2014 13:38:28Cannot store a failed command result

       

      Here's the top of the script, which I assume should work to get this bit of info, unless I need to change targets?

       

      SERVER_NAME=$NSH_RUNCMD_HOST

       

       

      datetime=$(date '+%Y%m%d-%H.%M.%S')

      logpath="/tmp/"

      outtype=".csv"

       

      tlBatchJob="/path/to/batchJob"

       

       

      blcli_setjvmoption -Dcom.bladelogic.cli.execute.quietmode.enabled=true

       

       

       

       

       

      blcli_execute BatchJob getDBKeyByGroupAndName "${tlBatchJob%/*}" "${tlBatchJob##*/}"  #Thanks Bill

      blcli_storeenv jobDBKey

      blcli_execute Job executeAndWaitAgainstServers "$jobDBKey" "${SERVER_NAME}"

      blcli_storeenv jobRunKey

      blcli_execute Utility storeTargetObject jobRunKeyTgt

      blcli_execute Utility setTargetObject jobRunKeyTgt

      blcli_execute JobRun getJobName

      blcli_storeenv tlBatchJobName

      blcli_execute JobRun getJobRunId

      blcli_storeenv tlBatchJobRunId

      blcli_execute JobRun getJobKey

      blcli_storeenv tlBatchJobKeyForRun

      blcli_execute JobRun getDBKey

      blcli_storeenv tlBatchJobDBKey

       

       

       

      echo "###################################\n"

      echo "jobDBKey: $jobDBKey\n"

      echo "jobRunKey: $jobRunKey\n"

      echo "tlBatchJobName: $tlBatchJobName\n"

      echo "tlBatchJobRunId: $tlBatchJobRunId\n"

      echo "tlBatchJobDBKey: $tlBatchJobDBKey\n"

      echo "tlBatchJobKeyForRun: $tlBatchJobKeyForRun\n"

       

      for j in {0..$((${tlBatchLength}-1))}

      do

      blcli_execute Utility setTargetObject tlBatchJobRuns

      blcli_execute Utility listItemSelect ${j}

      blcli_execute Utility setTargetObject

      blcli_execute BatchJob isByStage

      blcli_storeenv byStage

      blcli_execute JobRun getJobRunId

      blcli_storeenv mjJobRunId

      blcli_execute JobRun getType

      blcli_storeenv jobType

      blcli_execute JobRun getJobKey

      blcli_storeenv mjJobKeyForRun

      blcli_execute Job getDBKey

      blcli_storeenv mjJobDBKey

      blcli_execute JobRun getJobName

      blcli_storeenv jobName

      blcli_execute Job getGroupId $jobDBKey

      blcli_storeenv groupID

      blcli_execute Group getAQualifiedGroupName "5005" "$groupID"

      blcli_storeenv groupName

       

       

      echo "###################################\n"

      echo "byStage: $byStage\n"

      echo "mjJobRunId: $mjJobRunId\n"

      echo "jobType: $jobType\n"

      echo "mjJobKeyForRun: $mjJobKeyForRun\n"

      echo "mjJobDBKey: $mjJobDBKey\n"

      echo "jobName: $jobName\n"

      echo "groupID: $groupID\n"

      echo "groupName: $groupName\n"