9 Replies Latest reply on Jan 7, 2011 7:53 AM by Steven Alexson

    How i can use a Class Property in nsh Script

      Hello,

       

      i have defined a Class Property. In a BL Depot i can use this Property as ??TARGET.CLASS.property??

       

      How i can use the same Property in a nsh-Script?

       

       

      Anyone have any suggestions?

        • 1. Re: How i can use a Class Property in nsh Script
          Bill Robinson

          You need to use blcli calls in your script to query for the value of the property or property instance.

          • 2. Re: How i can use a Class Property in nsh Script

            Thank you.

            But what ist the correct Command?

            Can you give an example.

             

            blcli .... ???

            • 3. Re: How i can use a Class Property in nsh Script
              Bill Robinson

              it depends on what you want to do. look in the propertyclass or propertyinstance name spaces.

              • 4. Re: How i can use a Class Property in nsh Script

                I need more help

                 

                Ok.

                 

                1. I have a class "project_x" in this class, i have any subclasses "type_a" as example. In this Class exist any Instances. I have a "property_1" with value "test"

                2. A Server has a Server Property "project_x" with a value like a Instance from any Subclass.

                3. I need the value from "this_Server"."project_x"."type_a"."property_1"

                 

                What is the correct Syntax/Statement for this? Have you an Example.

                 

                My Test was this:

                 

                blcli PropertyClass getDefaultValue Class://SystemObject/project_x property_1

                 

                This show the DefaultValue, but not the Value from the Server.class.subclass.instanz.value

                • 5. Re: How i can use a Class Property in nsh Script

                  In your example, all you need is this:

                   

                   

                   

                  blcli_execute Server printPropertyValue

                   

                   

                   

                   

                  I tested your scenario in my VM:

                   

                   

                   

                  testrhel4# blcli_execute Server printPropertyValue localhost project_x

                   

                  Class://SystemObject/project_x/type_a/instance_1

                  • 6. Re: How i can use a Class Property in nsh Script

                    Thank you. It works.

                     

                    I use this:

                     

                    blcli Server printPropertyValue $SERVER "Projekt.property"

                    • 7. Re: How i can use a Class Property in nsh Script
                      Steven Alexson

                      Does this still work the same in 8.0?  We just upgraded from 7.6 to 8.0 SP5, and now a script that queries a Server property isn't working. The property that is queried is an instance of a custom propery class. The script queries a value within the class. This worked up until the upgrade.

                       

                      Here is the code snippet:

                       

                      blcli_execute Server printPropertyValue server1 "APPS1.ENVIRONMENT"

                       

                      When I run the command in a BLCLI subshell, this is the error I get:

                       

                      BLCLI> Server printPropertyByName server1 APPS1.ENVIRONMENT
                      Command execution failed. com.bladelogic.mfw.util.BlException: Ambiguous or unknown property reference for Server in printPropertyByName: APPS1.ENVIRONMENT

                       

                      Like I said, this was working in 7.6. In fact it has been working for the last couple of years. Did something change with 8.0 in regards to this command?

                      • 8. How i can use a Class Property in nsh Script
                        R V

                        Do you still have this problem?

                         

                        You say, your script queries a "Server property" and  then is "an instance of a custom property class". What is true? Maybe  the custom property class is referenced in another Server-property, but  that's a different thing.

                         

                        What you will probably need is:

                         

                        blcli_execute PropertyInstance getFullyResolvedPropertyValue "Class://SystemObject/Some/Other/ClassPath/APPS1" "ENVIRONMENT"

                         

                        - but that's just a guess as I don't know what exactly you mean with "APP1.ENVIRONMENT".

                         

                        If your problem is already solved it would be great if you tell about the solution.

                        • 9. Re: How i can use a Class Property in nsh Script
                          Steven Alexson

                          I have a custom Server property called APPS1. This property is defined as Type = Property class. The value of the property APPS1 when set is an instance of a custom property class we created.

                           

                          Since this initial post, I have made a new discovery. The problem seems to be that during the 8.0 upgrade from 7.6, the way properties store property class values changed. They used to be stored as a class path (i.e. Class://...). Now, however, they are stored as a DBKey. So, when I try to retrieve a value of a property within the custom property class by referencing it through the custom Server property (i.e. APPS1.ENVIRONMENT), "PropertyInstance getFullyResolvedPropertyValue" fails because the Server property does not contain a class path to the custom property class instance.

                           

                          In any case, BMC has told me that there will be a fix for this in 8.0 SP8. So, I have to just wait and see.