9 Replies Latest reply on Oct 3, 2016 6:46 AM by Bill Robinson

    Problem While using BLCLI Commands to Remove MemberJobs from Batch Job?

    Aryan Anantwar

      Hi Friends,

       

      I want to create a batch Job using BLCLI without adding any member job while creating the Job.

       

      But, I won't find such commands. the Commands for BatchJob createBatchJob must require memberJobDBkey as a third parameter.

       

      So, for the workaround, I have added an Testjob to batchJob while creating it.

      Now, the Batch Job is Created, but i want to remove that member Testjob from batchJob.

       

      Here, I tried BatchJob removeMemberJobByJobKeyAndIndex DBKey of BatchJob JobIndex(As mentioned in BLCLI Help, the jobs are in 'O' indexed list)

      i.e blcli_execute BatchJob removeMemberJobByJobKeyAndIndex &BATCHJOB_KEY $JOB_INDEX

      where, BATCHJOBKEY= DBKey:SJobModelKeyImpl:4163-1-2054235  & JOB_INDEX= 0

       

      but it returns following error

       

      "Command execution failed. com.bladelogic.om.infra.model.base.dependency.xml.NewerVersionedObjectException: A new version of this object has been saved since you  last loaded it. You must load the new version of the object before you can make changes to it."

       

      Please Somebody help me on this.

      (BSA Version : 8.2.01.273 )

       

       

      Regards,

      Aryan Anantwar

        • 1. Re: Problem While using BLCLI Commands to Remove MemberJobs from Batch Job?
          Siddu angadi

          Below is the Correct syntax:

           

           

          blcli_execute BatchJob removeMemberJobByJobKeyAndIndex $BATCHJOB_KEY $JOB_INDEX

          • 2. Re: Problem While using BLCLI Commands to Remove MemberJobs from Batch Job?
            Aryan Anantwar

            Hey Siddu.

             

            In my post it was a typo & sorry for that.

             

            I have tried as below & still getting the error.

             

            blcli_execute BatchJob removeMemberJobByJobKeyAndIndex $BATCHJOB_KEY $JOB_INDEX

             

             

             

            Regards,

            Aryan Anantwar

            • 3. Re: Problem While using BLCLI Commands to Remove MemberJobs from Batch Job?
              Siddu angadi

              Got it...

               

              It is because of not carrying fwd your BATCHJOB_KEY , because it is alreay used in someother command.

               

              If you triiger the get BATCHJOB_KEY command prior to the removeMemberJobByJobKeyAndIndex, it should work fine.

               

              Thanks

              SIddu

              • 5. Re: Problem While using BLCLI Commands to Remove MemberJobs from Batch Job?
                Aryan Anantwar

                Hi Siddu,

                 

                That's not the problem.

                Before executing removeMemberJobByJobKeyAndIndex  i have taken care to check is the BATCHJOB_KEY is properly assigned to VARIABLE or not.

                 

                following is the sample how I tested it.

                 

                JOB_INDEX=0

                 

                (also tried with JOB_INDEX=1)

                 

                BATCHJOB_KEY=`blcli_execute BatchJob getDbKeyByJobAndGroupName $JOB_GROUP $JOB_NAME`

                 

                echo $BATCHJOB_KEY

                 

                blcli_execute BatchJob removeMemberJobByJobKeyAndIndex $BATCHJOB_KEY $JOB_INDEX

                 

                 

                But, no success.

                 

                 

                Regards,

                Aryan Anantwar

                 

                • 6. Re: Problem While using BLCLI Commands to Remove MemberJobs from Batch Job?
                  Siddu angadi

                  Try the below code and let me know:

                   

                  ###################################

                  JOB_INDEX=0

                  blcli_execute BatchJob getDbKeyByJobAndGroupName "$JOB_GROUP" "$JOB_NAME"

                  blcli_storeenv BATCHJOB_KEY

                   

                  echo $BATCHJOB_KEY

                   

                  blcli_execute BatchJob removeMemberJobByJobKeyAndIndex $BATCHJOB_KEY "$JOB_INDEX"

                  ###################################

                  • 7. Re: Problem While using BLCLI Commands to Remove MemberJobs from Batch Job?
                    Bill Robinson

                    right - please do not use FOO=`blcli_execute ...` - that defeats the purpose of using the 'performance commands' as it spawns a new jvm.  the proper way to store a return value from a blcli_execute command is to use blcli_storeenv as siddu shows above.

                    • 8. Re: Problem While using BLCLI Commands to Remove MemberJobs from Batch Job?
                      James Donohue

                      Hello,

                      I'm getting the same error. I copy a Template from one location to another and then set Property values on the new Template, as shown:

                       

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

                      #
                      #

                      blcli_execute Template getDBKeyByGroupAndName "$TARGET_CT_GROUP" "$TARGET_CT_NAME"

                      blcli_storeenv TARGET_CT_DBKEY

                      #

                      blcli_execute Template setPropertyValue "$TARGET_CT_DBKEY" "BAC_REL_STATUS" "$CONDITION_BAC_REL_STATUS"

                      blcli_execute Template setPropertyValue "$TARGET_CT_DBKEY" "BAC_REL_NAME" "$CONDITION_BAC_REL_NAME"

                      blcli_execute Template setPropertyValue "$TARGET_CT_DBKEY" "BAC_REL_PLATFORM" "$CONDITION_BAC_REL_PLATFORM"

                       

                      === ERROR ===

                      Error Sep 30, 2016 4:36:29 PM Command execution failed. com.bladelogic.om.infra.model.base.dependency.xml.NewerVersionedObjectException: A new version of this object has been saved since you last loaded it. You must load the new version of the object before you can make changes to it.

                       

                      Error Sep 30, 2016 4:36:31 PM Command execution failed. com.bladelogic.om.infra.model.base.dependency.xml.NewerVersionedObjectException: A new version of this object has been saved since you last loaded it. You must load the new version of the object before you can make changes to it.

                      =============


                      The only way I seem to be able to circumvent the error is to keep initializing, as shown (which is certainly not an efficient solution)

                       

                      blcli_execute Template getDBKeyByGroupAndName "$TARGET_CT_GROUP" "$TARGET_CT_NAME"

                      blcli_storeenv TARGET_CT_DBKEY

                      blcli_execute Template setPropertyValue "$TARGET_CT_DBKEY" "BAC_REL_STATUS" "$CONDITION_BAC_REL_STATUS"

                       

                      blcli_execute Template getDBKeyByGroupAndName "$TARGET_CT_GROUP" "$TARGET_CT_NAME"

                      blcli_storeenv TARGET_CT_DBKEY

                      blcli_execute Template setPropertyValue "$TARGET_CT_DBKEY" "BAC_REL_NAME" "$CONDITION_BAC_REL_NAME"

                       

                      blcli_execute Template getDBKeyByGroupAndName "$TARGET_CT_GROUP" "$TARGET_CT_NAME"

                      blcli_storeenv TARGET_CT_DBKEY

                      blcli_execute Template setPropertyValue "$TARGET_CT_DBKEY" "BAC_REL_PLATFORM" "$CONDITION_BAC_REL_PLATFORM"

                      • 9. Re: Problem While using BLCLI Commands to Remove MemberJobs from Batch Job?
                        Bill Robinson

                        "The only way I seem to be able to circumvent the error is to keep initializing, as shown (which is certainly not an efficient solution)"

                        you are not circumventing anything.  when you run this:

                         

                        blcli_execute Template setPropertyValue "$TARGET_CT_DBKEY" "BAC_REL_STATUS" "$CONDITION_BAC_REL_STATUS"

                        there's a new version of the template stored.  this increments the dbkey.  the return value of Template.setPropertyValue should be the new dbkey, so you need to use the updated key that's returned for the next action on the template. 

                         

                        so you can do:

                        blcli_execute Template setPropertyValue "$TARGET_CT_DBKEY" "BAC_REL_STATUS" "$CONDITION_BAC_REL_STATUS"

                        blcli_storeenv TARGET_CT_DBKEY

                        blcli_execute Template setPropertyValue "$TARGET_CT_DBKEY" "BAC_REL_NAME" "$CONDITION_BAC_REL_NAME"

                        blcli_storeenv TARGET_CT_DBKEY

                        ....