2 Replies Latest reply on Jul 7, 2014 9:05 AM by Paul Thorp


      Hi all, we are using bladelogic 8.3 and I have used the following line in an nsh type 1 script to extract a property value that is a normal string type


      DRIVE=`blcli Server getFullyResolvedPropertyValue $HOST _DRIVE`


      the property Drive is a string value, and is the windows drive on which BMC stuff is installed. I then compare the returned value to a reference string and depending on a match go off and do other things, here is the simplified troubleshooting version


      if [ "$COMPANY" = "C" ]


              echo "C Match"


              echo "C no match"


      I want to use the concept elsewhere, with property of the type "string enumeration". It returns a value, which when echoed appears to be the string in the property value, but when compared to a matching reference string doesn't match. 


      COMPANY=`blcli Server getFullyResolvedPropertyValue $HOST _COMPANY`

      if [ "$COMPANY" = "This Company" ]


              echo "Company matches"


              echo "Company doesn't match"


      Is this due to the manner in which the return comes or is it something in the way I am making the comparisons.


      I can pull a reference value for a host for which I know the enumerated string value matches, and use this as my match - that compares correctly, or I can pass the enumerated string value as a parameter, and that also works, but these are workarounds to pulling the value direct. I've been racking my brains wondering why when it echo's as the right company string, it then doesn't match the company string as I would expect.


      can anyone shed light or do they have something similar working ?

        • 1. Re: getFullyResolvedPropertyValue
          Bill Robinson

          so a general comment - if you are doing a bunch of blcli in a script you should use the 'performance commands` - like:


          blcil_execute namespace command args

          blcli_storeenv FOO

          instead of

          FOO=`blcli namespace command args`

          it will be much faster.


          it may be there is a control character in the return... can you show an example of the return - like:


          blcli_execute Server getFullyResolvedPropertyValue $HOST _COMPANY

          blcil_storeenv COMPANY


          echo "xxx${COMPANY}xxx"

          • 2. Re: getFullyResolvedPropertyValue

            Thanks Bill,

                 I got round to trying this and there indeed is a non printed character at the end of the company name.

            I think when I tried to spot this I took the name of the enumerated string vlaue, which didn't have a trailing space, and not the value, which does.