8 Replies Latest reply on Dec 14, 2012 8:24 PM by Bill Robinson

    How to Set a Property on RedHat Errata & RPMs

    Eric Robeson

      I created an 'IT_Approved' property for RedHat Errata and RPM's, and would like to set the value with an NSH script. I think I should be able to do something like:


      DepotObject setPropertyValue $ERRATA_KEY IT_APPROVED True


      but to do that, I need the DB key of the DepotObject. I looked at using getDBKeyByTypeStringGroupAndName to retrieve it, but that doesn't seem to accomodate Errata.


      Does anyone have a working example of how to set properties of RedHat RPM's and Errata in a patch depot?



        • 1. Re: How to Set a Property on RedHat Errata & RPMs

          Hi Eric,

          Please use the below command



          Command format


          blcli PatchCatalog recursivelySetPropertyForCatalog groupPath propertyName value catalogTypeString





          blcli PatchCatalog recursivelySetPropertyForCatalog /Catalog/RedHat DESCRIPTION MyLinuxErrata ERRATA_INSTALLABLE




          • 2. Re: How to Set a Property on RedHat Errata & RPMs
            Eric Robeson

            That's close, but from what I read it cannot be targeted to specific Errata....it operates against an entire group. I want to set the property so that I can create a smart-group using it. If I already have all the Errata in a group, I wouldn't need the property set.


            Is there a command to modify a property on just one Errata at a time, when all I have to start with is the Errata name and depot location?




            • 3. Re: How to Set a Property on RedHat Errata & RPMs




              blcli_execute Group getGroupByQualifiedName 5018 "${Catalog}/Erratas"


              for Errata in $Erratas
                   blcli_execute DepotObject findAllByTypeAndName 305 "$Errata"
                   blcli_execute DepotObject getDBKey
                   blcli_execute Utility setTargetObject
                   blcli_execute Utility listPrint
                   blcli_storeenv ErrataKey
                   blcli_execute DepotObject setPropertyValue $ErrataKey IT_APPROVED true



              That was for Erratas, and if you wish to do the same for RPMs, then the changes are:

              - you need a list of rpm names, not erratas

              - in getGroupByQualifiedName, you pick RPMs smart group, not Erratas

              - in findAllByTypeAndName you use 68 (which is RPM installable), not 305 (which is Errata installable)


              "select * from object_type" - this is where you can get the type id for all objects (catalogs, installables, different kinds of smart groups, etc.)

              • 4. Re: How to Set a Property on RedHat Errata & RPMs
                Eric Robeson

                Thanks Lazar. Initial testing seems to show that the findAllByTypeAndName command is returning 3 entries, causing 'bad db key token' error with the subsequent setPropertyValue command. Below is the script output, with the commands preceding. Any idea why multiple entries would be returned when querying by a specific Errata name? I checked by creating a smart-group for any depot item with that name, and it only exists once in the catalog.


                # blcli_execute Group getGroupByQualifiedName 5018 "${Catalog}/Erratas"



                ## Starting RHBA-2007:0098

                # blcli_execute DepotObject findAllByTypeAndName 305 "$Errata"


                com.bladelogic.om.infra.model.depot.software.ErrataDepotSoftwareImpl@2a91fbbd, c



                # blcli_execute DepotObject getDBKey

                [DBKey:SDepotObjectModelKeyImpl:2125843-1-6127391, DBKey:SDepotObjectModelKeyImp

                l:2163984-1-6335649, DBKey:SDepotObjectModelKeyImpl:2212168-1-8178703]


                # blcli_execute Utility setTargetObject

                [DBKey:SDepotObjectModelKeyImpl:2125843-1-6127391, DBKey:SDepotObjectModelKeyImp

                l:2163984-1-6335649, DBKey:SDepotObjectModelKeyImpl:2212168-1-8178703]


                # blcli_execute Utility listPrint





                # blcli_execute DepotObject setPropertyValue $ErrataKey IT_APPROVED True

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

                eption: Found command 'DepotObject.setPropertyValue' but with mismatching argume

                nts. : java.lang.IllegalArgumentException: Bad db key token : DBKey:SDepotObject




                • 5. Re: How to Set a Property on RedHat Errata & RPMs



                  After this command:

                  blcli_execute DepotObject findAllByTypeAndName 305 "$Errata"


                  Run this command to see what are the names of those objects:

                  blcli_execute DepotObject getName


                  What is your appserver version? I tested with 8.2 SP3.

                  Try with different Erratas, or RPM names, or different Catalog just to see if it's the same behavior.

                  • 6. Re: How to Set a Property on RedHat Errata & RPMs
                    Bill Robinson

                    if you take a look at this:



                    there's a mode where you can set property values on the depot objects, you might have to modify the logic a bit for your case but i believe that should work.  you'll need to create a mapping file w/ the errata name and the value of what you want to set iirc.

                    • 7. Re: How to Set a Property on RedHat Errata & RPMs
                      Eric Robeson

                      Turns out that we had 3 different RedHat patch depots, and the command provided by Lazar was picking up entries for the same errata in each depot. While waiting for the rogue depots to delete, I added some logic to handle multiple entries, and it is working now.



                      • 8. Re: How to Set a Property on RedHat Errata & RPMs
                        Bill Robinson

                        should his logic had already have been limiting this to a particular catalog ?


                        what changes did you make ?