2 Replies Latest reply on Mar 23, 2011 11:28 AM by Avikal Jain

    Error in updating the the deploy job target using blcli.

    Avikal Jain

      Hi, I am trying to update the deploy job target using blcli but is getting below error in the nsh script job log:


      Error Mar 22, 2011 5:01:16 PM Command execution failed. com.bladelogic.mfw.util.BlException: A new version of this object has been saved by another user. Your changes cannot be saved.


      I am reading a file which contains information about servers on which the deploy job has to be executed, my nsh script reads the server name one by one in loop and executes the deploy job. For first entry everything runs fine but nsh script fails when it tries to add the target in second loop and so on.


      Here's the script I am using:


      echo Info 2.0 "Resolving ENV_NAME, HOST_NAME and PATCH information from the file......please wait!!!!!!" 
                      ENV_NAME=`echo $VAL | awk -F"," '{print $1}'`
                      echo $ENV_NAME


                      HOST_NAME=`echo $VAL | awk -F"," '{print $2}'`
                      echo $HOST_NAME


                      PATCH=`echo $VAL | awk -F "," '{print $3}'`
                      echo $PATCH


      #Get the deploy job jobKey
      blcli_execute DeployJob getDBKeyByGroupAndName "${DEPLOY_JOB_LOCATION}" "${DEPLOY_JOB_NAME}"
      blcli_storeenv DEPLOY_JOB_KEY

      echo Info 3.0 "Clearing old parameter values from deploy job "${DEPLOY_JOB_NAME}"
      blcli_execute DeployJob removeOverriddenParameterValue "${DEPLOY_JOB_LOCATION}" "${DEPLOY_JOB_NAME}" "${PARAMETER1_ENV_NAME}"
      blcli_execute DeployJob removeOverriddenParameterValue "${DEPLOY_JOB_LOCATION}" "${DEPLOY_JOB_NAME}" "${PARAMETER2_PATCH}"

      echo Info 4.0 "Clearing previous target from deploy job "${DEPLOY_JOB_NAME}"
      blcli_execute Job clearTargetServers "${DEPLOY_JOB_KEY}"


      echo Info 5.0 "Updating the parameter values from configuration file"
      blcli_execute DeployJob setOverriddenParameterValue "${DEPLOY_JOB_LOCATION}" "${DEPLOY_JOB_NAME}" "${PARAMETER1_ENV_NAME}" "$ENV_NAME"
      blcli_execute DeployJob setOverriddenParameterValue "${DEPLOY_JOB_LOCATION}" "${DEPLOY_JOB_NAME}" "${PARAMETER2_PATCH}" "$PATCH"


      echo Info 6.0 "Updating the target server from file"
      blcli_execute  Job addTargetServer "${DEPLOY_JOB_KEY}" "$HOST_NAME"

      echo Info 7.0 "Executing the job"
      blcli_execute DeployJob executeJobAndWait "${DEPLOY_JOB_KEY}"


      Any ideas why it is failing?