Your workflow must have the following defined as an Input Paramater.
[Properties]payload = Custom Properties from vRA.
To access these
var machine = payload.get("machine") ; // From the Machine Object, you get fetch the real Custom Properties: var vCACVmProperties = machine.get("properties") ; if (vCACVmProperties != null) { var array = new Array(); for each (var key in vCACVmProperties.keys) { array.push(key + " : " + vCACVmProperties.get(key)); } array.sort(); for each (var line in array) { System.log (line + "\n"); } }
Your workflow must have the following defined as an Output Paramater, in addiontal the event must be run as blocking.
[Properties] virtualMachineDeleteProperties = Contains list of properties to delete, value does not matter. [Properties] virtualMachineAddOrUpdateProperties = Contains list of properties to create or update. **Value CANNOT be null! (vRA will Crash!)** [string] virtualMachineEvent = "BuildFailure" or "BuildSuccess" Note: Setting the virtualMachineEvent to "BuildFailure" will NOT result in the rest of the events not to be triggered, this all depends witch event you are in. However "Cleanup" events will be triggered after "Success" events are triggered. Note2: Setting the virtualMachineEvent to "BuildSucess" will say that the machine is "finished" (runs the same events later on as BuildFailure Note3: These can only be used in Events that Support vCacProperties (See Tables)
If you set “BuildFailure” or “BuildSucess” in or after VMPSMasterWorkflow32.BuildingMachine Post event (After Template is cloned and VM is customized) MachineProvisioned and MachineActived events will stil trigger.
State | Phase | Event | vCACProperties |
---|---|---|---|
VMPSMasterWorkflow32.Requested | PRE | - | Yes |
VMPSMasterWorkflow32.Requested | EVENT | VMPSMasterWorkflow32.Requested.EVENT.OnProvisionMachine | Yes |
VMPSMasterWorkflow32.Requested | POST | - | Yes |
VMPSMasterWorkflow32.WaitingToBuild | PRE | - | No |
VMPSMasterWorkflow32.WaitingToBuild | POST | - | No |
VMPSMasterWorkflow32.BuildingMachine | PRE | - | Yes |
CloneWorkflow.CloneMachine | PRE | - | No |
CloneWorkflow.CloneMachine | EVENT | CloneWorkflow.CloneMachine.EVENT.OnCloneMachineComplete | No |
CloneWorkflow.CustomizeMachine | PRE | - | No |
CloneWorkflow.CustomizeMachine | EVENT | CloneWorkflow.CustomizeMachine.EVENT.OnCustomizeMachineComplete | No |
CloneWorkflow.InitialPowerOn | PRE | - | No |
CloneWorkflow.InitialPowerOn | EVENT | CloneWorkflow.InitialPowerOn.EVENT.OnInitialPowerOnComplete | No |
CloneWorkflow.CustomizeOS | EVENT | CloneWorkflow.CustomizeOS.EVENT.OnCustomizeOS | No |
CloneWorkflow.BuildComplete | PRE | - | No |
VMPSMasterWorkflow32.VMPSMasterWorkflow32 | EVENT | VMPSMasterWorkflow32.VMPSMasterWorkflow32.EVENT.OnBuildSuccess | No |
VMPSMasterWorkflow32.BuildingMachine | POST | - | Yes |
SET BUILDFAILURE ON ANY OF EVENTS FROM THIS STAGE (will not trigger the next events) | |||
VMPSMasterWorkflow32.MachineProvisioned | PRE | - | Yes |
VMPSMasterWorkflow32.MachineProvisioned | POST | - | Yes |
VMPSMasterWorkflow32.VMPSMasterWorkflow32.MachineActivated | PRE | - | Yes |
VMPSMasterWorkflow32.VMPSMasterWorkflow32.MachineActivated | POST | - | Yes |
Will still trigger these events | |||
VMPSMasterWorkflow32.VMPSMasterWorkflow32 | EVENT | VMPSMasterWorkflow32.VMPSMasterWorkflow32.EVENT.onBuildFailure | No |
VMPSMasterWorkflow32.Disposing | PRE | - | Yes |
VMPSMasterWorkflow32.Disposing | EVENT | VMPSMasterWorkflow32.Disposing.EVENT.OnDisposeComplete | Yes |
VMPSMasterWorkflow32.Disposing | POST | - | Yes |
If you set “BuildFailure” in the VMPSMasterWorkflow32.Requested events. The machine will still be cloned. UNLESS you also set it in the VMPSMasterWorkflow32.BuildingMachine PRE event
State | Phase | Event | vCACProperties | Comment |
---|---|---|---|---|
Set BuildFailure on any of below… | ||||
VMPSMasterWorkflow32.Requested | PRE | - | Yes | |
VMPSMasterWorkflow32.Requested | EVENT | VMPSMasterWorkflow32.Requested.EVENT.OnProvisionMachine | Yes | |
VMPSMasterWorkflow32.Requested | POST | - | Yes | |
VMPSMasterWorkflow32.WaitingToBuild | PRE | - | No | |
VMPSMasterWorkflow32.WaitingToBuild | POST | - | No | |
Set BuildFailure on any of these above… | ||||
VMPSMasterWorkflow32.BuildingMachine | PRE | - | Yes | |
VMPSMasterWorkflow32.VMPSMasterWorkflow32 | EVENT | VMPSMasterWorkflow32.VMPSMasterWorkflow32.EVENT.onBuildFailure | No | Notice event triggered, but still machine will be cloned! |
CloneWorkflow.CloneMachine | PRE | - | No | |
CloneWorkflow.CloneMachine | EVENT | CloneWorkflow.CloneMachine.EVENT.OnCloneMachineComplete | No | |
CloneWorkflow.CustomizeMachine | PRE | - | No | |
CloneWorkflow.CustomizeMachine | EVENT | CloneWorkflow.CustomizeMachine.EVENT.OnCustomizeMachineComplete | No | |
CloneWorkflow.InitialPowerOn | PRE | - | No | |
CloneWorkflow.InitialPowerOn | EVENT | CloneWorkflow.InitialPowerOn.EVENT.OnInitialPowerOnComplete | No | |
CloneWorkflow.CustomizeOS | EVENT | CloneWorkflow.CustomizeOS.EVENT.OnCustomizeOS | No | |
CloneWorkflow.BuildComplete | PRE | - | No | |
VMPSMasterWorkflow32.BuildingMachine | POST | - | Yes | |
VMPSMasterWorkflow32.Disposing | PRE | - | Yes | |
VMPSMasterWorkflow32.Disposing | EVENT | VMPSMasterWorkflow32.Disposing.EVENT.OnDisposeComplete | Yes | |
VMPSMasterWorkflow32.Disposing | POST | - | Yes |
If you set “BuildFailure” in the VMPSMasterWorkflow32.BuildingMachine PRE event, the template will not be cloned.
State | Phase | Event | vCACProperties | |
---|---|---|---|---|
VMPSMasterWorkflow32.Requested | PRE | - | Yes | |
VMPSMasterWorkflow32.Requested | EVENT | VMPSMasterWorkflow32.Requested.EVENT.OnProvisionMachine | Yes | |
VMPSMasterWorkflow32.Requested | POST | - | Yes | |
VMPSMasterWorkflow32.WaitingToBuild | PRE | - | No | |
VMPSMasterWorkflow32.WaitingToBuild | POST | - | No | |
VMPSMasterWorkflow32.BuildingMachine | PRE | - | Yes | Setting “BuildFailure” here will skip the cloning |
CloneWorkflow.CloneMachine | PRE | - | No | |
VMPSMasterWorkflow32.VMPSMasterWorkflow32 | EVENT | VMPSMasterWorkflow32.VMPSMasterWorkflow32.EVENT.onBuildFailure | No | |
VMPSMasterWorkflow32.BuildingMachine | POST | - | Yes | |
VMPSMasterWorkflow32.Disposing | PRE | - | Yes | |
VMPSMasterWorkflow32.Disposing | EVENT | VMPSMasterWorkflow32.Disposing.EVENT.OnDisposeComplete | Yes | |
VMPSMasterWorkflow32.Disposing | POST | - | Yes |