I'm building a workflow to apply mandatory customization to a vApp Template based on the username, organization, etc. (similar to the Customize VM Sample workflow). I trigger the workflow on the blocking task of vdcInstantiateVapp.
I'm having an issue that if when the vApp Template is added to the cloud, the "Power on after instantiation" checkbox is marked, the workflows doesn't complete before the vApp VMs power on, which results in them running first time customization with incorrect values (hostname, arguments/options to the postcustomization script).
I've found that I can tell if the user has cheched this option by using VctlTask.getParams() to retrieve the VclInstantiateVAppParams object, however, I can't seem to figure out a way to change the powerOn true to false and then have the workflow issue the deploy command after the VM customization is complete. I looked at VclTask.update(), however it expects a VclTaskParam object, not a VclInstantiateVAppParam object.
Is there a way to convert the VAppParam to a TaskParam, or some other way to make sure that the workflow completes before the powerOn happens?
I've already tried adding Deploy vApp as a blocking task, but that doesn't work, as the vdcInstantiateVapp task doesn't trigger a second blocking task for Deploy vApp.
e.g:
taskRef = blockingTask.getTask(); task = vcdHost.getEntityByReference(VclFinderType.TASK, taskReference); taskParams = task.getParams(new VclInstantiateVAppParams()); if ( taskParams.powerOn == true ) { taskParams.powerOn=false; deployAfterWorkflow=true; }