9 Replies Latest reply on Apr 5, 2017 6:38 PM by Bill Robinson

    Get a list of Deploy Job Properties by blcli/jython

      Hello,

       

      How can I get a list of all property names (local BLPackage properties) included in a certain Deploy Job (BLPackage Deploy Job) by blcli commands or jython in v8.0? I've been looking around so many discussions but I couldn't find the exact solution for this problem.

       

      What we try to do is to get the list of the local properties that one job has. Those properties are class properties type which values are given by different instances on that class.

       

      Thanks in advance.

       

      Alex

        • 1. Re: Get a list of Deploy Job Properties by blcli/jython

          Clarifying question: Are you looking for property names in a deploy job? Or are you looking for property values (the actual class name) set to be used in a deploy job? Or are you looking for property values (the actual class name) used in a deploy job run?

          • 2. Get a list of Deploy Job Properties by blcli/jython

            Hi,

             

            Thanks for your fast reply.

             

            We are looking for the Property names in a deploy job, and the type of those as well. If we can get the property type as well, then know the class property, and then it's possible for us to know the instances as well (with the command listAllInstanceNames we can get the list of instances that conform a class property).

             

            We do this because we have a jython script that modifies the instance of the local property that each job has and immediately after that, executes against a server. Thus those properties are class properties, we just change the instances to get different values for the properties of the class property.

             

            In our environment, we have a big amount of different Deploy Jobs (something like 300) and each Deploy Job has two or three different local properties (and, at the same time, each local property can get its values on three or four different instances). So what we want is an automatization process that allows us to get this data without having to introduce it manually every time that we want to execute the script.

             

            I hope it's more or less clear my explanation.

             

            Alex

            • 3. Re: Get a list of Deploy Job Properties by blcli/jython
              Bill Robinson

              I'm not sure exactly, but here's a start -

               

              in the unrelased commands html, look at DeployJob.setOverriddenParameterValue.

               

              Look at the sequence of invoked commands.  instead of doing sets in there, you can probably run some gets on some of the objects returned. 

               

              you probably want the value of the overridden PSI.

              • 4. Get a list of Deploy Job Properties by blcli/jython

                this is mainly the command we use to change the value of the Deploy Job property:

                 

                blcli_execute DeployJob setOverriddenParameterValue "${DEPLOY_JOB_PATH}" "${DEPLOY_JOB_NAME}" "${BLP_LOCAL_PROPERTY_NAME}" "Class://SystemObject/${PROPERTY_CLASS_NAME}/${INSTANCE}"

                 

                isn't there a command that will give us a list of all the properties $BLP_LOCAL_PROPERTY_NAME and the $PROPERTY_CLASS_NAME of each one?

                 

                Where should I change the sets for gets? This is the sequnce of invoked commands:

                 

                CommandInputReturn value stored name
                DeployJob.getDBKeyByGroupAndName$groupName$ $jobName$jobKey
                Job.findByDBKeyNAMED_OBJECT=jobKey-
                Utility.storeTargetObjectmyDeployJob-
                DeployJob.getAssociatedDeployedPackageInstanceBeanno inputprototypeInstanceBean
                Utility.setTargetObjectno input-
                PropertySetInstanceBean.getValueTypeno inputclassObject
                Utility.setTargetObjectno input-
                PropertySetClass.getPropertyByName$parameterName$propertyObject
                Utility.setTargetObjectno input-
                Property.getPropertyTypeno inputpropertyType
                BlValue.createBlValueNAMED_OBJECT=classObject NAMED_OBJECT=propertyType $valueAsString$parameterValue
                Utility.setTargetObjectprototypeInstanceBean-
                PropertySetInstanceBean.setOverriddenBlValueNAMED_OBJECT=propertyObject NAMED_OBJECT=parameterValue-
                Utility.setTargetObjectmyDeployJob-
                DeployJob.removeComponentPropertyMapValueNAMED_OBJECT=propertyObject-
                Job.updateno input-

                 

                Alex

                • 5. Get a list of Deploy Job Properties by blcli/jython
                  Bill Robinson

                  Ok, so you can try this:

                   

                  blcli_execute DeployJob getDBKeyByGroupAndName "/Group" "JobName"

                  blcli_storeenv jobKey

                  blcli_execute Job findByDBKey ${jobKey}

                  blcli_execute DeployJob getAssociatedDeployedPackageInstanceBean

                  blcli_execute Utilty setTargetObject

                  blcli_execute PropertySetInstanceBean getOverriddenProperties

                  blcli_execute Utility setTargetObject

                  blcli_execute Utility listPrint

                   

                  That gave me something like this:

                  Property: TEST_PROP1: 2113800

                  Property: TEST_PROP2: 2113801

                  Property: DATE_MODIFIED: 1000004

                  Property: NAME: 1000001

                  Property: DESCRIPTION: 1000002

                  Property: ROLE_MODIFIED: 1000008

                  Property: ROLE_CREATED: 1000006

                  Property: USER_CREATED: 1000005

                  Property: USER_MODIFIED: 1000007

                  Property: DATE_CREATED: 1000003

                   

                  only TEST_PROP1 and TEST_PROP2 were custom for my env, all the others are the standard object properties so those could be filtered out w/ some sed/awk/etc you can probably figure out how to strip out the props

                   

                  then you can run:

                   

                  blcli_execute PropertySetInstanceBean getPropertyValueAsString TEST_PROP1

                   

                  and get the value of the property.

                  • 6. Re: Get a list of Deploy Job Properties by blcli/jython
                    Matthew Ragland

                    Hey Bill, what if I want to retrieve the default value set for a BlPackage?

                     

                    So far I have this:

                    blcli_execute BlPackage getDBKeyByGroupAndName "$PACKAGE_GROUP" "$PACKAGE_NAME"

                    blcli_storeenv DBKey

                    blcli_execute DepotObject findByDBKey ${DBKey}

                    blcli_execute Utility setTargetObject

                     

                    I have tried seemingly all the unreleased "get" commands for the BlPackage namespace. I believe I need to capture a classfield ID, and then use it with this command:

                    getDefaultValueClass

                     

                    Any suggestions?

                    • 7. Re: Get a list of Deploy Job Properties by blcli/jython
                      Bill Robinson

                      i think once you load the depot object you want to run the getAssociatedInstance command and then the rest from above:

                      blcli_execute Utilty setTargetObject

                      blcli_execute PropertySetInstanceBean getOverriddenProperties

                      blcli_execute Utility setTargetObject

                      blcli_execute Utility listPrint

                      • 8. Re: Get a list of Deploy Job Properties by blcli/jython
                        Matthew Ragland

                        Bill,

                             I tried what you suggested, but I get [], am I missing something? Here is my command execution:

                         

                        bsa% blcli_execute DepotObject findByDBKey ${DBKey}

                        com.bladelogic.om.infra.model.depot.blpackage.BlPackageImpl@a7df6d48

                         

                        bsa% blcli_execute Utility setTargetObject

                        com.bladelogic.om.infra.model.depot.blpackage.BlPackageImpl@a7df6d48

                         

                        bsa% blcli_execute BlPackage getAssociatedInstance

                        PSI : MySQL 5.7 - RHEL6 :

                         

                        bsa% blcli_execute Utility setTargetObject

                        PSI : MySQL 5.7 - RHEL6 :

                         

                        bsa% blcli_execute BlPackage getOverriddenProperties

                        []

                        • 9. Re: Get a list of Deploy Job Properties by blcli/jython
                          Bill Robinson

                          try:

                           

                           

                          blcli_execute BlPackage getDBKeyByGroupAndName "/Workspace" "test1"

                          blcli_storeenv dbKey

                          blcli_execute DepotObject findByDBKey ${dbKey}

                          blcli_execute BlPackage getLocalParametersClass

                          blcli_execute Utility setTargetObject

                          blcli_execute Utility storeTargetObject psc

                          blcli_execute PropertySetClass getPropertiesMap

                          blcli_execute Utility setTargetObject

                          blcli_execute Utility mapPrint

                          blcli_storeenv propertyMap

                           

                          while read i

                                  do

                                  blcli_execute Utility setTargetObject psc

                                  blcli_execute PropertySetClass getDefaultPropertyValueAsString "${i}"

                                  blcli_storeenv propVal

                                  echo "${i}:${propVal}"

                          done <<< "$(awk '{print $1}' <<< "${propertyMap}")"