7 Replies Latest reply on Feb 4, 2020 4:02 AM by mmonkman

    vRA8 Using the EBS & vRO to update resourceNames?

    thegrumpyengineer Novice

      Hi.

      In vRA7 I used to update the VM hostname by creating an output of virtualMachineAddOrUpdateProperties in vRO and updating the property value as follows:

       

       

      function updateProps(props, key, value) {

       

          if (value != null && value.length > 0) {

              System.debug("Update properties " + key + "=" + value);

              props.put(key,value);

          } else {

              System.error("Error updating properties " + key + " +=empty value");

          }

         

      }

       

      virtualMachineAddOrUpdateProperties = payload.virtualMachineAddOrUpdateProperties || new Properties();

      updateprops(virtualMachineAddOrUpdateProperties, "Hostname", "newname");

      updateprops(virtualMachineAddOrUpdateProperties, "VirtualMachine.Admin.Name", "newname");

       

      I am trying to replicate this in vRA8 (cloud assembly) via vRO and hitting problems and was wondering if anyone had managed it yet??

       

       

      resourceNames = inputProperties || new Properties();

      delete resourceNames['resourceNames'][0]

      resourceNames['resourceNames'].push("newMachineName")

       

       

      This workflow triggers at the "Compute.allocation.pre" phase and completes successfully.

       

      However, within cloud assembly I get the following error:

       

      "Extensibility triggered task failure: Expected BEGIN_ARRAY but was STRING at line 1 column 279 path $.resourceNames"

       

       

      Within the workflow I printed inputProperties at the start of the workflow and resourceNames at the end and I can see the resourceNames field has been updated as expected...

       

      InputProperties

      2020-01-22 15:35:08.000 +00:00infoBegin logging properties

      2020-01-22 15:35:08.000 +00:00infoblueprintId :: string :: 6c549b32-e76f-4455-a894-809361178892

      2020-01-22 15:35:08.000 +00:00infocomponentId :: string :: demo-machine

      2020-01-22 15:35:08.000 +00:00infocomponentTypeId :: string :: Cloud.vSphere.Machine

      2020-01-22 15:35:08.000 +00:00infocustomProperties :: Properties :: HashMap:384042417

      2020-01-22 15:35:08.000 +00:00info- count :: string :: 1

      2020-01-22 15:35:08.000 +00:00info- customizationSpec :: string :: Linux_Custom_Spec

      2020-01-22 15:35:08.000 +00:00info- image :: string :: ubuntu

      2020-01-22 15:35:08.000 +00:00info- resourceGroupName :: string :: VRM/DEV PROJECT

      2020-01-22 15:35:08.000 +00:00info- sdlc :: string :: test

      2020-01-22 15:35:08.000 +00:00infodeploymentId :: string :: 31ee7ea5-f690-4b9e-be24-b1531e7ac470

      2020-01-22 15:35:08.000 +00:00infoendpointId :: string :: 91d7ed61ef9b327559c975bd9fa02

      2020-01-22 15:35:08.000 +00:00infoexternalIds :: Array :: 0d4a9418-9acd-42b6-a39b-70fe7b7c6c51

      2020-01-22 15:35:08.000 +00:00infohostSelectionIds :: Array :: 91d7ed61ef9b327559c975cfecaf0

      2020-01-22 15:35:08.000 +00:00infoprojectId :: string :: 5c4b2ce9-7838-485b-b03d-8ae7002cdc15

      2020-01-22 15:35:09.000 +00:00inforequestId :: string :: a27b2b03-72bf-4443-8230-da8b46a50eb8

      2020-01-22 15:35:09.000 +00:00inforesourceIds :: Array :: f4cc3f33eaa2947559cbc43ce2f60

      2020-01-22 15:35:09.000 +00:00inforesourceNames :: Array :: demo-machine-mcm626-128100897615

      2020-01-22 15:35:09.000 +00:00infotags :: Properties :: HashMap:666784176

      2020-01-22 15:35:09.000 +00:00info- Backup :: string :: Gold

      2020-01-22 15:35:09.000 +00:00infoEnd Logging Properties

       

      resourceNames

      2020-01-22 15:35:09.000 +00:00infoblueprintId :: string :: 6c549b32-e76f-4455-a894-809361178892

      2020-01-22 15:35:09.000 +00:00infocomponentId :: string :: demo-machine

      2020-01-22 15:35:09.000 +00:00infocomponentTypeId :: string :: Cloud.vSphere.Machine

      2020-01-22 15:35:09.000 +00:00infocustomProperties :: Properties :: HashMap:384042417

      2020-01-22 15:35:09.000 +00:00info- count :: string :: 1

      2020-01-22 15:35:09.000 +00:00info- customizationSpec :: string :: Linux_Custom_Spec

      2020-01-22 15:35:09.000 +00:00info- image :: string :: ubuntu

      2020-01-22 15:35:10.000 +00:00info- resourceGroupName :: string :: VRM/DEV PROJECT

      2020-01-22 15:35:10.000 +00:00info- sdlc :: string :: test

      2020-01-22 15:35:10.000 +00:00infodeploymentId :: string :: 31ee7ea5-f690-4b9e-be24-b1531e7ac470

      2020-01-22 15:35:10.000 +00:00infoendpointId :: string :: 91d7ed61ef9b327559c975bd9fa02

      2020-01-22 15:35:10.000 +00:00infoexternalIds :: Array :: 0d4a9418-9acd-42b6-a39b-70fe7b7c6c51

      2020-01-22 15:35:10.000 +00:00infohostSelectionIds :: Array :: 91d7ed61ef9b327559c975cfecaf0

      2020-01-22 15:35:10.000 +00:00infoprojectId :: string :: 5c4b2ce9-7838-485b-b03d-8ae7002cdc15

      2020-01-22 15:35:10.000 +00:00inforequestId :: string :: a27b2b03-72bf-4443-8230-da8b46a50eb8

      2020-01-22 15:35:10.000 +00:00inforesourceIds :: Array :: f4cc3f33eaa2947559cbc43ce2f60

      2020-01-22 15:35:10.000 +00:00inforesourceNames :: Array :: newMachineName

      2020-01-22 15:35:10.000 +00:00infotags :: Properties :: HashMap:666784176

      2020-01-22 15:35:10.000 +00:00info- Backup :: string :: Gold

      2020-01-22 15:35:10.000 +00:00info__item_stack:/item0

       

      There's a good chance i'm doing something stupid but I can't see it!!!