8 Replies Latest reply on Jul 13, 2017 2:11 AM by Andreas Koppenhoefer

    PatchCatalog.createOrUpdatePatchCatalogs

    Andreas Koppenhoefer

      Dear all,

       

      we just upgraded BladeLogic Server Automation from 8.3 to 8.6. While reading in the "unsupported" BLCLI commands list of 8.6 I discovered a new complex command:

      PatchCatalog.createOrUpdatePatchCatalogs

      The description reads: "This command creates or updates the catalogs given in the input xml file."

       

      Maybe BMC is so kind and gives us some information about the definition of the config xml file and optionally an example?

      I would like to create solaris patch catalogs by script as all my other patching stuff is also done by scripts.

       

      With kind regards

      Andreas

        • 1. Re: PatchCatalog.createOrUpdatePatchCatalogs
          Bill Robinson

          try the attached.

           

          not sure about online for rhel, might be like solaris.  also not sure about the other types, probably not too hard to figure out though w/ some trial and error.

          • 2. Re: PatchCatalog.createOrUpdatePatchCatalogs
            Andreas Koppenhoefer

            Many thanks for your reply, Bill.

            I will give it a try in the next few days.

             

            Your sample xml files are all for "Online" catalogs.

            Do you have also some examples for "Offline download"?

            That would shorten my trial and error efforts.

            • 3. Re: PatchCatalog.createOrUpdatePatchCatalogs
              Bill Robinson

              The rhel one is offline.  i think you need to set the payload source in the offline as well.

              • 4. Re: PatchCatalog.createOrUpdatePatchCatalogs
                Andreas Koppenhoefer

                Hello Bill,

                 

                you are right - the rhel sample is an offline one.

                I was successful in creating a minimal Solaris offline patch catalog.

                 

                What's still missing are the following settings:

                Repository Options

                • Source patchdiag.xref File
                • Metadata Corrections File
                • Single User Mode And Reboot Override File

                Depot Object Options

                • RBAC Policy (needs to be set to "PatchCatalog.Read")

                I tried to guess the xml names but I failed.

                 

                Would you please give some more samples containing these options?

                As an alternative: how can I set/update those options with other BLCLI commands right after using PatchCatalog.createOrUpdatePatchCatalogs?

                I could not find anything appropriate in the list of (unsupported) BLCLI commands.

                 

                - Andreas

                • 5. Re: PatchCatalog.createOrUpdatePatchCatalogs
                  Andreas Koppenhoefer

                  I just found BLCLI command

                       PatchCatalog.generateSolarisCatalogCreationTemplate

                  This command generates the input xml file for a given catalog. All I had to do is to manually build a Catalog with all options set and then convert this Catalog to a xml template.

                   

                  Now there is only one last question left:

                  How can I set Depot Object Option "RBAC Policy" in a SolarisPatchCatalog, which needs to be set to "PatchCatalog.Read"?

                   

                  Maybe this can be set with

                  • PatchCatalog.createOrUpdatePatchCatalogs (I guess: no)
                  • Some other BLCLI command?
                  • Maybe it can be set as a default in Property Dictionary? (Maybe, but which Property class do I have to change?)

                   

                  - Andreas

                  • 6. Re: PatchCatalog.createOrUpdatePatchCatalogs
                    Bill Robinson

                    get the dbkey of the CUJ.

                    get the id of the acl policy

                     

                    blcli_execute Job findByDBKey ${cujKey}

                    blcli_execute Utility storeTargetObject cuj

                    blcli_execute RedHatCatalogUpdateJob setOptionValue 1015 ${aclPolicyId}

                    blcli_execute Job update NAMED_OBJECT=cuj

                     

                    ?

                    • 7. Re: PatchCatalog.createOrUpdatePatchCatalogs
                      Andreas Koppenhoefer

                      Bill, thanks for your reply.

                      I try to translate your hints for my SolarisPatchCatalog. Here is a complete example.

                      But it is not yet working.

                       

                           blcli_execute BlAclPolicy findByName "PatchCatalog.Read"

                           blcli_execute BlAclPolicy getBlAclPolicyId

                           blcli_storeenv policyID

                           MyCatalog=/Patching/solaris-10-sparc.catalog

                           blcli_execute PatchCatalog createOrUpdatePatchCatalogs /tmp/config.xml

                           blcli_execute PatchCatalog getCUJDBKeyByFullyQualifiedCatalogName \

                                SOLARIS "$MyCatalog"

                           blcli_storeenv cujKey

                           blcli_execute Job findByDBKey $cujKey

                           blcli_execute Utility storeTargetObject cuj

                           blcli_execute SolarisCatalogUpdateJob optionValueSet

                           # This command is throwing an exception:

                           blcli_execute SolarisCatalogUpdateJob setOptionValue 1015 $policyID

                           blcli_execute Job update NAMED_OBJECT=cuj

                       

                      The "setOptionValue" subcommand does not work because it cannot decide whether my policyID is an integer or a string. The error message is as follows:

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

                      Command execution failed. com.bladelogic.om.infra.cli.factory.CommandNotFoundException: Command : (SolarisCatalogUpdateJob,setOptionValue) has more than one overloaded methods that match given arguments

                      Arg [0] : 1015

                      Arg [1] : 2001500

                      API Command Info : setOptionValue

                          Actual method : setOptionValue

                          Class name : com.bladelogic.om.patch.model.job.catalogUpdate.SolarisCatalogUpdateJob

                          Arg[0] : int

                          Arg[1] : int

                      API Command Info : setOptionValue

                          Actual method : setOptionValue

                          Class name : com.bladelogic.om.patch.model.job.catalogUpdate.SolarisCatalogUpdateJob

                          Arg[0] : int

                          Arg[1] : class java.lang.String

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

                      How can I fix this? I know how to create my own BLCLI command which expects only an integer. But there must be an easier way for doing this, like flagging the given policy ID number as "int".

                       

                      - Andreas