I'm trying to get any useful information from the payload sent by a Change Lease operation, so I can also adjust the destruction time. My workflow is receiving the payload and several __asd_* inputs, but none of them seem to refer to anything I can use to look up the vm or deployment.
None of these actually refer to a catalog item, catalog item request, or resource action request, as far as I can tell. They all throw 404 errors when I try to look them up with another workflow:
payload.requestId
payload.deploymentId
__asd_catalogRequestId
__asd_correlationId
__asd_requestInstanceId
__asd_targetResourceId
I can go through vRO's browser to find requests and items, and then paste those IDs in to my workflows, and that works.
Any nudge in the right direction would be most appreciated. Thanks in advance!
Hi, filosmith
I managed to get deployment using the following code:
var items = vCACCAFEEntitiesFinder.getCatalogResources(vcacCafeHost); //vcacCafeHost - vCACCAFE:VCACHost, need to be specified as attribute
for each(item in items){
if(item.providerBinding.bindingId == deploymentId){ //depoment ID which comes as input
System.log("Deployment name: " + item.name);
System.log("Deployment lease: " + item.lease.getEnd());
}
}
Hope this will help you.
Hi, filosmith
I managed to get deployment using the following code:
var items = vCACCAFEEntitiesFinder.getCatalogResources(vcacCafeHost); //vcacCafeHost - vCACCAFE:VCACHost, need to be specified as attribute
for each(item in items){
if(item.providerBinding.bindingId == deploymentId){ //depoment ID which comes as input
System.log("Deployment name: " + item.name);
System.log("Deployment lease: " + item.lease.getEnd());
}
}
Hope this will help you.
Thank you very much, bulatkaz
Welp, they broke that solution. As usual.
Unable to retrieve over 100 machines in vRO workflow or vRA UI/API call (2149013) | VMware KB
Hi filosmith,
Below is another one way, from vRA Plug-In official guide
var requestId = __asd_correlationId; //from payload
var service = vcacCafeHost.createCatalogClient().getCatalogConsumerResourceService();
var filter = new Array();
filter[0] = vCACCAFEFilterParam.equal("request", vCACCAFEFilterParam.string(requestId));
var query = vCACCAFEOdataQuery.query().addFilter(filter);
var items = service.getResourcesList(new vCACCAFEPageOdataRequest(query));
for each(var item in items) {
if(item.resourceTypeRef.getLabel() == "Deployment") {
var deployment = item; //vCACCAFECatalogResource type
break;
}
}
The above solution is working only for successful deployments. How do we get for failed catalog requests?
Hi filosmith bulatkaz
In which way the below code has been modified to get the VMs above 100 by matching deploymentId?
Regards
Bala
Hi bulatkaz,
I have the payload as input in my workflow. The first lines are
var machine = payload.get("machine");
var properties = machine.get("properties")
since I need some custom properties but adding your code in the script doesn't work.
The workflow gives this error: Get Catalog Resource / Scriptable task (item2)#7) Data Integrity validation error.
I see the __asd_correlationId in the variables after the workflow has run but it doesn't seem to use it in the workflow. When I use your code but set the correlationId as a manual input, everything works.
Hope you can help me find the missing piece to process the correclationId correctly.
ps: I'm on 7.5 HF1