I am using workflow to generate the hostnames for VM's it working for name generation for single VM as part of same deployment but when I try to provision more one VM Instance which are going to part of same deployment getting following error. Need an expert advise how to enable support for multiple instances in Custom naming template
Are you adding the numerical part at the end of the Naming Template? ( ${######} )
No, Below is the setting used, then names and numbers are generated using is vRO workflow
What does your workflow look like and when are you calling it?
Why don't you try with a Name Template like: ${resource.name}-${######}?
I understand that you have a workflow that change the name of the resource but I'm not sure if the error isn't fired before.
The Name Template that asking me to try is not meeting our requirements and hence had to write vRO flows to generate the hostnames
The error indicates that your workflow output array 'resourceNames' only contains one element.
Are you sure you're pushing all the names into the array?
It is an array but with array[0], we need to rewrite the script for to support multiple array items based on the selection number of instances. I am not sure how to write that script
Assuming your ABX workflow is subscribed at "Compute Provision" - this is some sample vRO code to pack up the array. Ours is only fit for one VM resource, but no reason you cannot extend this for a higher count:
//action code. previous code does our hostname allocations, validations, etc.
//input: (string)validatedHostname
//you will want to change this to a string array
customProperties = inputProperties.customProperties || new Properties();
resourceNames = inputProperties.resourceNames;
resourceNames[0] = validatedHostname;
//add more here based on your logic...
//resourceNames[1] = "hostname2";
//resourceNames[2] = "hostname3";
System.log("Attempting to send new hostname back in payload: " + validatedHostname);
System.log("New/updated resource names: " + resourceNames);
}
Is this what you are looking for?
@j_dubs Thank you for help, this is working now.