14 Replies Latest reply on Oct 14, 2019 3:34 PM by Bill Robinson

    Modify Patch Analysis options via BLCLI

    Simon Wardley
      Share This:

      We have 650+ patching jobs within BladeLogic.

       

      It's now been decided that the MRT tool etc. should be included in patches which would mean ticking the "Analysis options -> Group -> Security tools" option for every patching job.

      Having looking at BLCLI docs I cannot see any commands to tick the Security tools option.

       

      Is there a BLCLI command for this?

        • 1. Re: Modify Patch Analysis options via BLCLI
          Newton Nyante

          Looks like in the unreleased command set you could do this via:

          PatchingJob setWindowsAnalysisOptions

           

           

          Unreleased blcli commands and documentation

          1 of 1 people found this helpful
          • 2. Re: Modify Patch Analysis options via BLCLI
            Simon Wardley

            Hi Newton,

             

            Thanks for the reply

            so i'm using the following command:

            blcli -v defaultProfile PatchingJob setWindowsAnalysisOptions '/Jobs....full patch analysis job path' "" "" "true" "" "" ""

             

            I'm doing the empty variables in the hope that this should only modify the security tools option to true and leave the rest as was in the job.

             

            I'm getting the following error:

            <job path> cannot be converted to the expected type: interface com.bladelogic.om.patch.model.job.patching.PatchingJob

            • 3. Re: Modify Patch Analysis options via BLCLI
              Bill Robinson

              this command needs the job to be passed in as an in memory object.  so something like:

               

              blcli_execute PatchingJob getDBKeyByGroupAndName "/patching" "job"

              blcli_storeenv jobKey

              blcli_execute Job findByDBKey ${jobKey}

              blcli_execute Utility storeTargetObject job

              blcli_execute PatchingJob setWindowsAnalysisOptions NAMED_OBJECT=job ....

              • 4. Re: Modify Patch Analysis options via BLCLI
                Simon Wardley

                Hi Bill,

                 

                Thanks for the help but my patching job is still not ticking the Security Tools analyssis options script below:

                 

                #!/bin/nsh

                blcli_execute PatchingJob getDBKeyByGroupAndName '/Tools And Automation Team/_Users/Simon' "test"

                blcli_storeenv jobKey

                blcli_execute Job findByDBKey ${jobKey}

                blcli_execute Utility storeTargetObject job

                blcli_execute PatchingJob setWindowsAnalysisOptions NAMED_OBJECT=${job} "" "" "true" "" "" ""

                 

                Any ideas?

                • 5. Re: Modify Patch Analysis options via BLCLI
                  Bill Robinson

                  blcli_execute PatchingJob setWindowsAnalysisOptions NAMED_OBJECT=job "" "" "true" "" "" ""

                  not

                  blcli_execute PatchingJob setWindowsAnalysisOptions NAMED_OBJECT=${job} "" "" "true" "" "" ""

                   

                  NAMED_OBJECT=job is not a reference to a shell variable.  it's a java object stored in memory by the Utility storeTargetObject job command.

                   

                  3 of 3 people found this helpful
                  • 6. Re: Modify Patch Analysis options via BLCLI
                    Simon Wardley

                    Hi Bill,

                     

                    So:

                    #!/bin/nsh

                    blcli_execute PatchingJob getDBKeyByGroupAndName '/Tools And Automation Team/_Users/Simon' "test"

                    blcli_storeenv jobKey

                    echo "jobkey: ${jobKey}"

                    blcli_execute Job findByDBKey ${jobKey}

                    blcli_execute Utility storeTargetObject job

                    blcli_execute PatchingJob setWindowsAnalysisOptions NAMED_OBJECT=job "" "" "true" "" "" ""

                     

                    Results in a job failure?

                     

                    Info 13-Sep-2019 16:07:22 JobRun Log Settings: JobRun Limit = 1000000

                    Info 13-Sep-2019 16:07:22 Started running the job 'BLANSHGEN-Patch job options modifier' with priority 'NORMAL' on application server 'job1'(6)

                    Info 13-Sep-2019 16:08:00 Executing work item NSH Script Job:BLANSHGEN-Patch job options modifier;  on application server: job1

                    Info 13-Sep-2019 16:08:01 DBKey:SJobModelKeyImpl:122107-2-3182851jobkey: DBKey:SJobModelKeyImpl:122107-2-3182851

                    Error 13-Sep-2019 16:08:02 Command execution failed. com.bladelogic.om.infra.cli.factory.CommandNotFoundException: Found command 'PatchingJob.setWindowsAnalysisOptions' but with mismatching arguments.

                    Info 13-Sep-2019 16:08:02 com.bladelogic.om.patch.model.job.patching.WindowsPatchingJobImpl@1e464ef8com.bladelogic.om.patch.model.job.patching.WindowsPatchingJobImpl@1e464ef8

                    Info 13-Sep-2019 16:08:02 Exit Code 1

                    Info 13-Sep-2019 16:08:02 Execution Override not enabled for job 'BLANSHGEN-Patch job options modifier' .

                    Info 13-Sep-2019 16:08:02 Full path to job 'BLANSHGEN-Patch job options modifier' : 'Jobs/Tools And Automation Team/_Users/Simon'

                    Info 13-Sep-2019 16:08:02 Job 'BLANSHGEN-Patch job options modifier' was manually executed by User:Role 'Simon.Wardley':'BLAdmins'.

                    Info 13-Sep-2019 16:08:02 Debug mode is enabled for job 'BLANSHGEN-Patch job options modifier' .  Check appserver log(s) for file location.

                    Error 13-Sep-2019 16:08:02 The job 'BLANSHGEN-Patch job options modifier' has failed

                    • 7. Re: Modify Patch Analysis options via BLCLI
                      Simon Wardley

                      Am i best raising a support call for this?

                      • 8. Re: Modify Patch Analysis options via BLCLI
                        Bill Robinson

                        I think you need to pass more options here:

                        blcli_execute PatchingJob setWindowsAnalysisOptions NAMED_OBJECT=job "" "" "true" "" "" ""

                        the last four arguments need a Boolean.

                         

                        blapp894# blcli_execute PatchingJob setWindowsAnalysisOptions NAMED_OBJECT=job "" "" "true" "" "" ""

                        Command execution failed. com.bladelogic.om.infra.cli.factory.CommandNotFoundException: Found command 'PatchingJob.setWindowsAnalysisOptions' but with mismatching arguments. : java.lang.IllegalArgumentException: Expected boolean (true/false) recieved :

                        blapp894# blcli_execute PatchingJob setWindowsAnalysisOptions NAMED_OBJECT=job "" "" "true" "false" "false" "false"

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

                        • 9. Re: Modify Patch Analysis options via BLCLI
                          Simon Wardley

                          I'm trying to just set the security tools to true, is there any way to find out what the values are currently set to in the job via blcli, i didn't see anything obvious in the unreleased commands.......

                           

                          such as blcli_execute PatchingJob getWindowsAnalysisOptions?

                          • 10. Re: Modify Patch Analysis options via BLCLI
                            Bill Robinson

                            blcli_execute PatchingJob getDBKeyByGroupAndName "/Workspace/Patching Jobs" "Windows 2016"

                            blcli_storeenv jobKey

                            blcli_execute  Job findByDBKey ${jobKey}

                            blcli_execute PatchingJob getAnalysisJob

                            blcli_execute Utility setTargetObject

                            blcli_execute PatchAnalysisJob getOptionStringValue 912

                            that returns a number.  it's the sum of these:

                            1 - Security patches

                            4 - Security tools

                            8 - Non-Security Patches

                             

                            if it's 4 or 5 or > 9 then it's set.

                            1 of 1 people found this helpful
                            • 11. Re: Modify Patch Analysis options via BLCLI
                              Simon Wardley

                              Hi,

                               

                              So if the above pulls out the values for:

                              • security patches
                              • Security Tools
                              • Non-Security Patches

                              That leaves the following as unknown:

                              • Include File
                              • Exclude File
                              • Service Pack

                               

                              Ideally I just need to set the security tools option to true.

                              I was hoping the empty variables would cause the command to leave those values as they currently are set in the job.

                               

                              i'm guessing this is going to be a pretty hefty script....... so any ideas how i also pull out the include/exclude files and Service pack.

                               

                              Is there an option like export, modify xml and re-import, or a sql script....(I know ...not supported)

                              • 12. Re: Modify Patch Analysis options via BLCLI
                                Bill Robinson

                                how often do you need to do this ? and how many jobs do you have ?  10s ? 100s ?

                                • 13. Re: Modify Patch Analysis options via BLCLI
                                  Simon Wardley

                                  There's 666 patch analysis jobs in total and i'm hoping to do this just once but it would be good to have a script in the events the jobs are created incorrectly again

                                  • 14. Re: Modify Patch Analysis options via BLCLI
                                    Bill Robinson

                                    there's probably some sql to run, i'd open a ticket...