14 Replies Latest reply on Dec 27, 2010 2:48 PM by Jim Campbell

    Hotfix return code overrides

    Jim Campbell

      I'm looking for a way to set a return code override for hotfixes.  I'd prefer a way to override the code for every hotfix in a patch catalog, but I haven't even been able to find a way to script it statically.

       

      I see DepotSoftware.setDepotSoftwareReturnCodeOverridesByDBKey which requires a handle to the hotfix.

       

      I need something to be able to pull all of the handles for hotfixes out of (preferably) a Patch Catalog Smart Group but I could manage it if I could even find a way to get the handles from a Depot Smart Group.  As far as I can tell, DepotObject.getDBKeyByTypeStringGroupAndName doesn't work for even DepotSmartGroups and only works for a depot folder.  I can get the patch names from PatchCatalog.listAllByCatalogNameAndType but I can't get the group.

        • 1. Re: Hotfix return code overrides
          Bill Robinson

          Try something like:

           

          blcli_execute DepotObject findAllByType 114

          blcli_execute DepotObject getDBKey

          blcli_execute Utility setTargetObject

          blcli_execute Utility listPrint

          blcli_execute Utility setTargetObject

          blcli_storeenv DBKeys

           

          for key in ${DBKeys}

          do

          blcli_execute DepotSoftware setDepotSoftwareReturnCodeOverridesByDBKey ${key} .. .. .. ..

          done

           

          that would set all the hotfix objects to have the same return codes.  if you need to be more specific you need a mapping file and then some other commands in there like 'getName' or something else.

          • 2. Re: Hotfix return code overrides
            Jim Campbell

            So i'll need to run that, iterate through each key, use DepotObject.getNameByDBKey, compare the name from that to a list of names derived from PatchCatalog.listAllByCatalogNameAndType and set the override code for anything that matches?  Is there really no way to get to a list of database handles for hotfixes from a Depot Smartgroup?

             

            Attempt number 1 at running this just to get a list of the db handles gave:

            Command execution failed. java.lang.OutOfMemoryError: Java heap space

            so I'm a bit leary of my chances of being able to do all of the above.  Is there any way to get the db keys directly from the database?

            • 3. Re: Hotfix return code overrides
              Bill Robinson

              You could look at PatchCatalog.getDepotObjectsFromCatalogByOption but i'm not sure what to pass for 'optionid' or 'patchCons'.

               

              You could try 'DepotObject.findAllByGroup' using the group id for I think the catalog, or maybe one of the smart groups under it.  i'm not sure about that.

              1 of 1 people found this helpful
              • 4. Re: Hotfix return code overrides
                Jim Campbell

                Picked up _JAVA_OPTIONS: "-Xmx512M"
                Command execution failed. java.lang.OutOfMemoryError: Java heap space

                 

                So I'm not sure if this a practical solution at all, unless I've gotten the wrong options for increasing the heap size.

                • 5. Re: Hotfix return code overrides
                  Jim Campbell

                  What is in the input for DepotObject.findAllByGroup?  If i could get this to work (with a smart group) I'd be fine.  I tried giving it an ID from SmartDepotGroup.groupNameToDBKey and SmartDepotGroup.groupNameToId but both times got:

                   

                  Unknown command : name space = 'DepotObject', command = 'findAllByGroup'.com.bla
                  delogic.cli.factory.CommandNotFoundException: DepotObject,findAllByGroup Method
                  found but with mismatching arguments. Error was : Input '2001712' cannot be conv
                  erted to expected type : interface com.bladelogic.model.group.DepotGroup

                   

                  Unknown command : name space = 'DepotObject', command = 'findAllByGroup'.com.bla
                  delogic.cli.factory.CommandNotFoundException: DepotObject,findAllByGroup Method
                  found but with mismatching arguments. Error was : Input 'DBKey:SBLGroupModelKeyI
                  mpl:2001712-3130703' cannot be converted to expected type : interface com.bladel
                  ogic.model.group.DepotGroup

                  • 6. Re: Hotfix return code overrides
                    Bill Robinson

                    Try this:

                     

                    >blcli_execute PatchCatalog getCatalogGroupByFullyQualifiedCatalogName 5022 "/Path/to/catalog"

                    Id = 2002004;Name = Windows;Desc = Contains 2000, 2003, 2008 and all misc software

                    (sorry, looks like you can't just get the id out)

                    >blcli_execute DepotObject findAllHeadersByGroup 2002004

                    >blcli_execute DepotObject getDBKey

                    >blcli_execute Utility setTargetObject

                    >blcli_execute Utility listPrint

                    >blcli_execute Utility setTargetObject

                    >blcli_storeenv patchKeys

                     

                    for key in ${patchKeys}

                    do

                    DepotSoftware setDepotSoftwareReturnCodeOverridesByDBKey ....

                    done

                    • 7. Re: Hotfix return code overrides
                      Jim Campbell

                      If i'm understanding that last post right, it would pull out everything in the entire catalog instead of only the subset of the patch catalog defined in a Patch Catalog Smart Group?

                       

                      I was able to do this in an ugly fashion by pulling up a list within the UI from a Patch Catalog Smart Group, set a property on each of the listed hotfixes in the UI, defining a Depot Object smart group that filtered on that property, and then using a variant of the commands you listed above like:

                       

                      blcli_execute SmartDepotGroup groupNameToId "/Patch Catalogs/Office Whitelist"
                      blcli_storeenv GROUPID

                      blcli_execute DepotObject findAllByGroup $GROUPID true
                      blcli_execute DepotObject getDBKey
                      blcli_storeenv HOTFIXDBKEYS

                       

                      for HotfixKey in $HOTFIXDBKEYS
                      do
                      HotfixKey=$(echo "$HotfixKey" | tr -d '[' | tr -d ']' | tr -d ',')
                      blcli_execute DepotSoftware setDepotSoftwareReturnCodeOverridesByDBKey $HotfixKey ...

                      done

                       

                      (I'm sure there's a more elegant way to strip out extraneous characters but I'm used to perl)

                       

                      A couple of questions: 1) Is there any way to do this with perl?  I know there's a NSH module for perl but i'm unsure if it allows the use of the 'performance-enhancing' commands. 2) Is there a way to get a list of all (some?) of these 'undocumented' blcli commands?

                      • 8. Re: Hotfix return code overrides
                        Bill Robinson

                        Yes, that would be for all patch objects in a catalog.  Do you need to do it only for a subset?

                        • 9. Re: Hotfix return code overrides
                          Jim Campbell

                          Yes, from a Patch Catalog Smart Group (where the criterion is "Hotfix where Qnumber is one of Q12345, Q23456, etc")

                          • 10. Hotfix return code overrides
                            Bill Robinson

                            if you haven't figured it out, try this:

                             

                            blcli_execute Group groupNameToId "/Path/to/catalog/smart group" 5017

                            blcli_execute DepotObject findAllByGroup 2014105 true

                            blcli_execute DepotObject getDBKey

                            blcli_execute Utility setTargetObject

                            blcli_execute Utility listPrint

                            blcli_execute Utility setTargetObject

                            blcli_storeenv DBKeys

                             

                            for key in $DBKeys

                            do

                            ...

                            done

                             

                             

                            5017 is the 'SMART_WINDOWS_PATCH_CATALOG_GROUP'

                            • 11. Hotfix return code overrides
                              Jim Campbell

                              I'll try this out as it would be handy to have a way to access members of Patch Catalog Smart Groups.  I managed to make this work in the way I described above but now I'm not sure if overriding return codes on Hotfixes even works.  All of the hotfixes have the appropriate override but when we run our patch job we still get the error.  We've overriden return codes for other software before successfully, but I don't think we've ever done so for Hotfixes.

                              • 12. Hotfix return code overrides
                                Jim Campbell

                                So i used this with the following script:

                                 

                                blcli_connect

                                blcli_execute Group groupNameToId "/Production Packages/Patch Catalogs/Office 2007 Patch Catalog/test" 5017

                                blcli_storeenv SGID

                                blcli_execute DepotObject findAllByGroup $SGID true

                                blcli_execute DepotObject getDBKey

                                blcli_storeenv HOTFIXDBKEYS

                                for HotfixKey in $HOTFIXDBKEYS

                                do

                                HotfixKey=$(echo "$HotfixKey" | tr -d '[' | tr -d ']' | tr -d ',')

                                echo .

                                echo -------------------------------------------------------

                                blcli_execute DepotObject getNameByDBKey $HotfixKey

                                echo .

                                blcli_execute DepotSoftware showDepotSoftwareReturnCodeOverridesByDBKey $HotfixKey

                                done

                                blcli_disconnect

                                 

                                I used a Patch Catalog Smart Group named "test" with a criterion of "QNUMBER = 'Q982308'".  I set the override return codes for the 6 hotfixes that matched and verified the return codes had been set.  I then run patch analysis and rechecked the return codes, and two of them (presumably the two that were packaged for deployment) were changed.  A patch remediation job came back as failed with the expected (supposedly) overriden exit code.  One of the two offending hotfix depot objects:

                                 

                                Before Patch Analysis (This happened both with and without the override for "success with reboot" being retained when I set the override)

                                -------------------------------------------------------

                                excel2007-kb982308-fullfile-x86-glba.exe-MS10-038-en-EXCEL 2007-SP2.

                                Return Code Overrides for "install" Command:

                                    "success with reboot" override(s) = 3010

                                    "success" override(s) = 17022,17025

                                Return Code Overrides for "uninstall" Command: none

                                DBKey:SDepotObjectModelKeyImpl:27617-1-4390170

                                 

                                After Patch Analysis:

                                -------------------------------------------------------

                                excel2007-kb982308-fullfile-x86-glba.exe-MS10-038-en-EXCEL 2007-SP2.

                                Return Code Overrides for "install" Command:

                                    "success with reboot" override(s) = 3010

                                Return Code Overrides for "uninstall" Command: none

                                DBKey:SDepotObjectModelKeyImpl:27617-1-4390170

                                 

                                Not sure if this behaviour is intended or not.

                                • 13. Hotfix return code overrides
                                  Bill Robinson

                                  you know you can use the

                                  blcli_execute Utility listPrint

                                   

                                  instead of the tr's...

                                   

                                  i'm wondering if this is expected - because in order to run a patch deploy the role needs software.modify on all the patch objects, so i'm wondering if it's re-writing the return codes during remediation.

                                   

                                  i think you did this but try:

                                  dump return codes

                                  set return codes

                                  dump return codes

                                  run paj/remediation

                                  dump return codes

                                   

                                  if the return codes change (which i think you are seeing) i'd open a ticket about this.

                                  • 14. Hotfix return code overrides
                                    Jim Campbell

                                    It looks like the "Patch Global Configuration" settings for Windows Patches overwrite any return code overrides you set manually.  I did notice that when using DepotSoftware : setDepotSoftwareReturnCodeOverridesByDBKey that it would overwrite the normal windows override that was previously set (success with reboot for return code 3001).  I would assume that the same function must be getting called when the patches are packaged up.  It would be more convenient if this funciton appended any changes to the override codes rather than overwriting all override codes, but we may be able to just use the global override since the return codes giving us problems seem to be generally useless anyway.