7 Replies Latest reply on Jun 12, 2012 2:57 PM by Bill Robinson

    Managing character case in BLPackage local properties

      Hi,

      I'm configuring a BLPackage with the use of local properties as parameters to be inserted at the run of the associated deploy job.

      In two different items of the BLPackage I have to use one of the properties, one time in lower another time in upper case.

      How can I manage this? The only idea I have is to use an external command using NSH scripting to manipulate the string, but this method it's not so smart.

      I'm using BBSA 8.0 on RHES 5.x targets.

      Thanks in advance!

       

      CArmine.

        • 1. Re: Managing character case in BLPackage local properties
          Bill Robinson

          you can use ‘tr’ in the ‘external command’ to change from upper to lower or vice versa.  Do like FOO=`echo ??PROPERTY?? | tr …` in the external command.

           

          the external command does not use NSH, it uses the native shell on the target system so for rhel this will be bash.

           

          Also – you are talking about property values here right? those need to be in all upper for one case, and all lower for another ?  can you explain why this is the case ?

          • 2. Re: Managing character case in BLPackage local properties

            I try to explain better the situation, with an example of what I have to do: departing from a property which value is a string, I have to do various tasks:

            • to create a user with the value of that property, all in upper case
            • to add entries to sudoers file, following this template:

            echo "

            # Utenza ${USER}

            Cmnd_Alias      ${USER}CMD = /prd/$user/bin/$APP

            $user           ALL=(tomcat)    NOPASSWD: ${USER}CMD

            #" >> /etc/sudoers

             

            In the script listed, ${USER} and $user have to be replaced by ??PROPERTY??, but in the first case I need it in upper case, in the second in lower case. $APP is a secondary parameter, obtained concatenating $USER with the value of another property.

            • 3. Re: Managing character case in BLPackage local properties
              Bill Robinson

              so why doesn't the example of 'FOO=`echo ??PROPERTY?? | tr …`' work here?

               

              also - what are you actually replacing in the test above - litterally $user or just 'user' and 'USER' ?

               

              why do you have these different variable cases in this file ?

              • 4. Managing character case in BLPackage local properties

                ??PROPERTY?? is entered in lower case... I'm replacing just 'user' and 'USER', where the two variables value is the first time ??PROPERTY?? as entered, the second time in upper case.

                 

                The use of |tr in an external command solved the problem.

                It wasn't so smart as I had to do this kind of manipulations of strings passed as local properties many times, and my blpackage is loaded with lots of external commands.

                 

                What I was looking for is an alternative solution, like a complex property or something like this.

                • 5. Re: Managing character case in BLPackage local properties
                  Bill Robinson

                  ok, i'm still not clear on what you are doing - you have a property called "??property??".  the value of property is "carmine".  you have a file that contains 'USER' and another file that contains 'user'.  You need to replace 'USER' and 'user' with 'carmine' ?

                   

                  what is actually changing in case here, the value of the property or the string you need to replace ?

                  • 6. Managing character case in BLPackage local properties

                    Sorry, probably I'm not clear in describing the situation.

                    Using you example, I have a property called ??property??, and its value is "carmine"

                    I have to add an entry to a configuration file, with value n.1 is "CARMINE" and value n.2 is "carmine".

                    • 7. Managing character case in BLPackage local properties
                      Bill Robinson

                      the only way to do is w/ a single property is to use tr or sed or whatever to change the case. there is no way to have a multi-valued property in the way that you want.  there are list and enumeration types, but you can't reference them in the blpackage as you would want to.  or you can have two properties - USER_Upper and USER_Lower and reference each as you need to.