6 Replies Latest reply on Jan 21, 2015 3:39 PM by David Vogelaar

    Assign property values to a newly created component

      #Create a server component

      blcli_execute Component createComponent $instanceName $TEMPLATE_KEY "$serverId"

       

      blcli_execute Component setPropertyValue $COMPONENT_KEY "property" "${<somevalue>}"

       

      When a I try assign property to the newly created object, i receive an error stating a newer object exists.    Is this by design?

        • 1. Re: Assign property values to a newly created component
          Bill Robinson

          so you are running:

           

          blcli_execute Component createComponent $instanceName $TEMPLATE_KEY "$serverId"

          blcli_storeenv COMPONENT_KEY

          blcli_execute Component setPropertyValue $COMPONENT_KEY "property" "${<somevalue>}"

          ?

           

          or how are you getting the component key ?

          • 2. Re: Assign property values to a newly created component

            Yes, sorry, should have included that as well. I am able to capture the component key and echo it out.

             


            #Create a server component

            blcli_execute Component createComponent $instanceName $TEMPLATE_KEY "$serverId"

            blcli_storeenv COMPONENT_KEY

            blcli_execute Component setPropertyValue $COMPONENT_KEY "property" "${<somevalue>}"

            • 3. Re: Assign property values to a newly created component
              Bill Robinson

              can you run the below and show all of the output?

               

              blcli_execute Component createComponent $instanceName $TEMPLATE_KEY "$serverId"

              blcli_storeenv COMPONENT_KEY

              blcli_execute Component setPropertyValue $COMPONENT_KEY "property" "${<somevalue>}"

              blcli_execute Component findByDBKey ${COMPONENT_KEY}

              blcli_execute Component getComponentId

              blcli_storeenv compId

              blcli_execute Component findLatestById ${compId}

              blcli_execute Utility setTargetObject

              blcli_execute Component getDBKey

              • 4. Re: Assign property values to a newly created component
                Bill Robinson

                ?everytime you set the property value i think it's incrementing the component version, so you need to use the dbkey from output of the previous set command as input to the next set.

                1 of 1 people found this helpful
                • 5. Re: Assign property values to a newly created component
                  Bill Robinson

                  i'm pretty sure the issue is that the problem is that you are not capturing the new key after you set the value.  the 'setPropertyValue' command runs an 'update' after it sets the property value.  i'm fairly certain that the component version is incremented which means you need a new dbkey...

                   

                   

                  you don't need the shell debug in there, that's not going to help figure out the problem w/ the blcli commands here so take out the set -x.

                   

                  blcli_execute Component createComponent $instanceName $TEMPLATE_KEY "$serverId"

                  blcli_storeenv COMPONENT_KEY

                  echo "COMPONENT_KEY: ${COMPONENT_KEY}"

                  blcli_execute Component setPropertyValue $COMPONENT_KEY "property" "${<somevalue>}"

                  blcli_execute Component getDBKeyByTemplateAndServer "${TEMPLATE_KEY}" ${serverId} 0

                  blcli_storeenv COMPONENT_KEY

                  echo "COMPONENT_KEY: ${COMPONENT_KEY}"



                  • 6. Re: Assign property values to a newly created component

                    Thanks Bill,

                    You we're right about the version incrementing with each setProperty to the component.  I go out and get the latest compent version before each update.   Thanks for your help!

                     

                     

                    blcli_execute Component findByDBKey ${COMPONENT_KEY}

                    blcli_execute Component getComponentId

                    blcli_storeenv compId

                    blcli_execute Component setPropertyValue $COMPONENT_KEY "property" "${<somevalue>}"