1 Reply Latest reply on Dec 9, 2013 12:30 PM by Bill Robinson

    Add properties to Erratas in Patch Catalog with blcli

    Antonio Caputo

      In the BSA console, I have defined a bollean property called _IS_TO_INSTALL on Depot Object->Software->Redhat Errata and set it as "false" by default.

       

      Now, supposing I have a file called $ERRATAS_FILE containing entries like this:

       

      RHSA-2012:0546

      RHBA-2011:0526

      RHSA-2010:0889

      RHSA-2011:0373

      RHSA-2011:1852

      RHBA-2011:0403

       

      I want to set the properties of that Erratas to "true" invoking blcli commands. I wrote this script:

       

      while read LINE

      do

        blcli_execute PatchCatalog getDBKeyByTypeAndNameFromCatalog RED_HAT_CATALOG_GROUP ERRATA_INSTALLABLE "/Patch_Analisi/RedHat-Catalogs/RHEL_5_x86" $LINE

        blcli_execute Utility storeTargetObject depot_object_key

       

        blcli_execute DepotObject setPropertyValue $depot_object_key _TO_BE_INSTALLED true

      done < $ERRATAS_FILE

       

      but it fails at the first blcli with the following error:

       

      DBKey:SDepotObjectModelKeyImpl:357465-1-20508451com.bladelogic.om.infra.model.depot.software.ErrataDepotSoftwareImpl@bb9b3c4cCommand execution failed.

      com.bladelogic.om.infra.mfw.util.BlException: Cannot find depot object by name : RHBA-2011:0526 in group : RHEL_5_x86 with type : ERRATA_INSTALLABLE

      Command execution failed. java.lang.Exception: No target object available

      DBKey:SDepotObjectModelKeyImpl:359518-1-20510504com.bladelogic.om.infra.model.depot.software.ErrataDepotSoftwareImpl@7ccab4daDBKey:SDepotObjectModelKe

      yImpl:359826-1-20510812com.bladelogic.om.infra.model.depot.software.ErrataDepotSoftwareImpl@c1b743beCommand execution failed. com.bladelogic.om.infra.

      mfw.util.BlException: Cannot find depot object by name : RHSA-2011:1852 in group : RHEL_5_x86 with type : ERRATA_INSTALLABLE

      Command execution failed. java.lang.Exception: No target object available

      Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: Cannot find depot object by name : RHBA-2011:0403 in group : RHEL_5_x86 with t

      ype : ERRATA_INSTALLABLE

      Command execution failed. java.lang.Exception: No target object available

       

      Another try is to use:

       

      blcli_execute PatchCatalog getDBKeyByTypeAndNameFromCatalog SMART_REDHAT_PATCH_CATALOG_GROUP ERRATA_INSTALLABLE "/Patch_Analisi/RedHat-Catalogs/RHEL_5_x86/Erratas" $LINE

       

      but it fails also:

       

      Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: Cannot find depot object by name : RHSA-2012:0546 in group : Erratas with type : ERRATA_INSTALLABLE

      Command execution failed. java.lang.Exception: No target object available

      Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: Cannot find depot object by name : RHBA-2011:0526 in group : Erratas with type : ERRATA_INSTALLABLE

      Command execution failed. java.lang.Exception: No target object available

      Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: Cannot find depot object by name : RHSA-2010:0889 in group : Erratas with type : ERRATA_INSTALLABLE

      Command execution failed. java.lang.Exception: No target object available

      Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: Cannot find depot object by name : RHSA-2011:0373 in group : Erratas with type : ERRATA_INSTALLABLE

      Command execution failed. java.lang.Exception: No target object available

      Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: Cannot find depot object by name : RHSA-2011:1852 in group : Erratas with type : ERRATA_INSTALLABLE

      Command execution failed. java.lang.Exception: No target object available

      Command execution failed. com.bladelogic.om.infra.mfw.util.BlException: Cannot find depot object by name : RHBA-2011:0403 in group : Erratas with type : ERRATA_INSTALLABLE

      Command execution failed. java.lang.Exception: No target object available

       

      Any hint?

       

      Thanks,

      Antonio

        • 1. Re: Add properties to Erratas in Patch Catalog with blcli
          Bill Robinson

          this works fine for me:

           

          blcli_execute PatchCatalog getDBKeyByTypeAndNameFromCatalog RED_HAT_CATALOG_GROUP ERRATA_INSTALLABLE "/Workspace/PatchCatalogs/RedHat 5 x86" "RHBA-2007:0098"

           

          DBKey:SDepotObjectModelKeyImpl:2007961-1-2035337

           

          are you sure that errata is in the catalog?  are there any control characters in your file - was it created on windows?  if so you need to script the control characters off the line like:

           

          while read LINE

          do

          LINE=`echo $LINE | tr -d '[:cntrl:]'`

            blcli_execute PatchCatalog getDBKeyByTypeAndNameFromCatalog RED_HAT_CATALOG_GROUP ERRATA_INSTALLABLE "/Patch_Analisi/RedHat-Catalogs/RHEL_5_x86" $LINE

            blcli_execute Utility storeTargetObject depot_object_key

           

            blcli_execute DepotObject setPropertyValue $depot_object_key _TO_BE_INSTALLED true

          done < $ERRATAS_FILE