9 Replies Latest reply on Mar 3, 2013 10:23 PM by Santosh Pande

    Blcli to add a patch in exclude list for a existing Patch Analysis Job ?

      Hi,

       

      I was looking for blcli command line to add a patch in exclude list for a existing PAJ.

       

      From existing blcli commands I can create a new PAJ with exclude list (black.list).

       

      But once this PAJ is created and if I want to add few more patches to exclude list of this new PAJ down the line !! How to get this done with blcli ??

       

      I am using BL 8.2 SP3

       

      Any help will be appreciated..

       

      Regards

       

      santosh

        • 1. Re: Blcli to add a patch in exclude list for a existing Patch Analysis Job ?

          Any help on this ?? Is there a way to achieve this via blcli ??

           

          Regards

           

          Santosh

          • 2. Re: Blcli to add a patch in exclude list for a existing Patch Analysis Job ?

            hey Santosh, there is an unreleased command available that maybe can do this:

             

            PatchingJob setWindowsAnalysisOptions $job $includeFile $excludeFile $analyzeSecurityTools $analyzeSecurityPatches $analyzeNonSecurityPatches $filterServicePacks

             

            Variable Name Variable Type
            $job  com.bladelogic.om.patch.model.job.patching.PatchingJob
            $includeFile  String
            $excludeFile  String
            $analyzeSecurityTools  Boolean
            $analyzeSecurityPatches  Boolean
            $analyzeNonSecurityPatches  Boolean
            $filterServicePacks  Boolean

             

             

            For $job you probably will need to obtain a db or job key of your patching job. And once you successfuly run the command to modify options, you may need to explicitely save the job by running this command in your script (also unreleased):

             

            Job update

             

            hopefully this actually works

            1 of 1 people found this helpful
            • 3. Re: Blcli to add a patch in exclude list for a existing Patch Analysis Job ?

              Hi Lazar,

               

              Thank you.

               

              I will check this unrelease blcli and keep updated.

               

              Regards

               

              Santosh

              • 4. Re: Blcli to add a patch in exclude list for a existing Patch Analysis Job ?
                Jim Wilson

                Hi Santosh,

                 

                Did this get resolved?

                If so, please can you update the discussion thread with details so that is can be marked as answered.

                 

                Thanks & Regards,

                Jim (Forum Manager/Facilitator)

                • 5. Re: Blcli to add a patch in exclude list for a existing Patch Analysis Job ?

                  Hi Lazar,

                   

                  As mentioned in your post I tried the commands but it gives an error, this is what I am trying

                   

                  JOB_FOLDER="/Test"

                  JOB_NAME="PAJ-OLD"

                   

                  #Get the DBKey of the Patch Analysis Job

                   

                  blcli_execute PatchingJob getDBKeyByGroupAndName "$JOB_FOLDER" "$JOB_NAME"

                  blcli_storeenv PAJ_DBKEY

                   

                  includeFile="//SERVERABC/c/Temp/include.lst"

                  excludeFile="//SERVERABC/c/Temp/exclude.lst"

                  analyzeSecurityTools=false

                  analyzeSecurityPatches=true

                  analyzeNonSecurityPatches=false

                  filterServicePacks=true

                   

                  blcli_execute PatchingJob setWindowsAnalysisOptions "$PAJ_DBKEY" "$includeFile" "$excludeFile" $analyzeSecurityTools $analyzeSecurityPatches$analyzeNonSecurityPatches $filterServicePacks

                   

                  I get the following error

                   

                  Command execution failed. com.bladelogic.om.infra.cli.factory.CommandNotFoundExc

                  eption: Found command 'PatchingJob.setWindowsAnalysisOptions' but with mismatchi

                  ng arguments. : java.lang.IllegalArgumentException: Input 'DBKey:SJobModelKeyImp

                  l:2167-4-2248567' cannot be converted to expected type : interface com.bladelogi

                  c.om.patch.model.job.patching.PatchingJob

                   

                  I am passing the PAJ DBkey to the job, what is the correct way to do this.

                   

                  Appreciate you help with this.

                   

                  Regards

                   

                  Santosh

                  • 6. Re: Blcli to add a patch in exclude list for a existing Patch Analysis Job ?

                    Hey Santosh, not sure how to get the correct key to pass, but whatever we pass needs to be of type: "com.bladelogic.om.patch.model.job.patching.PatchingJob", so I guess PatchingJob DBKey is not it.

                     

                    I guess I would try to pass any of the following to see if you hit it:

                    - PatchAnalysisJob getJobId or getJobKey

                    - PatchingJob getJobId or getJobKey

                    - Maybe something similar from Job namespace, or maybe you'll see another command

                     

                    If nothing works, then I'm not sure (you can always file a ticket I suppose) ... BR, anything else?

                    • 7. Re: Blcli to add a patch in exclude list for a existing Patch Analysis Job ?
                      Bill Robinson

                      you need to do this:

                       

                      JOB_FOLDER="/Test"

                      JOB_NAME="PAJ-OLD"

                       

                       

                      blcli_execute PatchingJob getDBKeyByGroupAndName "$JOB_FOLDER" "$JOB_NAME"

                      blcli_storeenv PAJ_DBKEY

                      blcli_execute Job findByDBKey $PAJ_DBKEY

                      blcli_execute Utility storeTargetObject patchingJob

                       

                      includeFile="//SERVERABC/c/Temp/include.lst"

                      excludeFile="//SERVERABC/c/Temp/exclude.lst"

                      analyzeSecurityTools=false

                      analyzeSecurityPatches=true

                      analyzeNonSecurityPatches=false

                      filterServicePacks=true

                       

                      blcli_execute PatchingJob setWindowsAnalysisOptions NAMED_OBJECT=patchingJob "$includeFile" "$excludeFile" $analyzeSecurityTools $analyzeSecurityPatches$analyzeNonSecurityPatches $filterServicePacks

                       

                       

                      the command takes the actual job object as the first argument, not the job key.

                      • 8. Re: Blcli to add a patch in exclude list for a existing Patch Analysis Job ?

                        Hi Bill,

                         

                        I tried the commands as per the instruction and there was no errors when command was executed.

                         

                        blcli_execute PatchingJob setWindowsAnalysisOptions "NAMED_OBJECT=patchingJob" "$includeFile" "$excludeFile" $analyzeSecurityTools $analyzeSecurityPatches $analyzeNonSecurityPatches $filterServicePacks

                         

                        com.bladelogic.om.patch.model.job.patching.WindowsPatchingJobImpl@bb8a23e5

                         

                        But the list option was not selected in the PAJ job and no changes happened to the job

                         

                        PAJ.PNG

                        The information from include\exclude files was not set and no changes happend on to the PAJ.

                         

                        My include and exclude list has smartgroups path, include list has following path "GROUP#/Workspace/Patching/Windows/Catalog/WIN2008/Approved'

                         

                        Exclude list has

                         

                        GROUP#/Workspace/Patching/Windows/Catalog/WIN2008/Unapproved

                         

                        Regards

                        • 9. Re: Blcli to add a patch in exclude list for a existing Patch Analysis Job ?

                          Hi Bill,

                           

                          Ignore my previous post, I got this working.

                           

                          I forgot to do a Job update afte it was executed.

                           

                          Thank you for the help it is appreciated.

                           

                          Hi Lazar,

                           

                          Thank you for the initial guidance for getting this working, it is appreciated.

                           

                          Regards

                           

                          Santosh