I have a workflow that takes an input parameter of type VC:VirtualMachine (name vm), the workflow calls a rest api, gets a job id back then waits a few seconds before starting a loop to check if the job is done or not.
This seemed to be working OK, but today I've noticed that the vm input parameter is changing to undefined during the workflow, to demonstrate I'm logging the vm name, then have a sleep timer for 10 seconds, then logging the vm name again. This is the output:
[2019-02-26 14:14:25.043] [I] VM: Server101
[2019-02-26 14:14:35.083] [I] VM: undefined
Log VM is just a script that is doing the following:
Both take vm as the input parameter.
If I look at the variables as the workflow runs I can see this:
Then after a while goes to this:
Does anyone know what could be causing this behaviour (I've attached an export of the workflow)?
I do not have a way to import this to look at the moment but one of the first things to check is the bindings in the workflow. Would you be able to share the in and out bindings?
Ahhh, sorry, I understand what's happening now!
If I set overwriteExisting to false and in effect restoring to a new VM this is OK.
When overwriteExisting is set to true, a restore job kicks off which is overwriting the VM. I didn't realise the VC:VirtualMachine input parameter would actually be 'refreshed' as the workflow runs!
The issue is that I need the vm data to determine configuration data for use further down the line. Is there a way to cache this data and stop it from being wiped out? I've tried copying the input parameter to another attribute, but that gets wiped out too......
I'm quite new to this stuff so thanks for your help so far!