Are you doing this in an EventBroker subscription? I ask due to this line in you code
var deploymentId = payload.get('deploymentId');
If this is in the EBS then you need to be aware that you cannot rely on CatalogResources existing within the scope of the VM provisioning lifecycle. The CatalogResource is not available at the Consumer level until after the Deployment request has completed (Note: I've not tried this in 7.6 so perhaps it's different? - can anyone from VMware confirm?)
I can recall from previous projects that the delay between the request completion and the Resource existing in the Consumer catalog might be sometimes in the order of minutes.
If this is not EBS then perhaps you still have a timing/ordering issue since the Consumer service can only report on resources it knows about and your DeploymentID is coming from an external source.
This was developed from 7.2 and we upgraded to 7.6 recently. Actually, this issue was there in 7.2 as well with more frequent. I thought this issue may be resolved after upgrade but started happening again and is little frequent. Also, sleep (30s) has been set before start gathering the details. Anyhow, I have retried the failed workflow after 15-25 mins of deployment is completed, but still its failing and unable to find the resources with deployment ID.
"If this is in the EBS then you need to be aware that you cannot rely on CatalogResources existing within the scope of the VM provisioning lifecycle. The CatalogResource is not available at the Consumer level until after the Deployment request has completed"
Is there any EBS event that trigger just after catalog request finished and catalog resource available at consumer level?
1 person found this helpful
I should also that my experience of the CatalogResource delay was in vRA 7.3 or so. I've been doing the same thing in a 7.5 installation (just today in fact ) and have not noticed that lag time. My deployment resource is more or less immediately present after the IaaS request has completed. I'm using the vRO Trigger mechanism to hand off requests using a service account (see the OOTB workflow @ Library / vRealize Automation / Requests / Wait for catalog item request)
Sany201110141 - Yes, very good point. This is the event you want
From the schema content there it looks like you will get the ID of the Deployment resource in the event so you'd need to look that up to access any details about it. This was helpful when I was doing working on this today - Finding vRA Virtual Machines upon successful Catalog Item Request Completed event
Sorry for late reply I was tied with other projects. Event after using with "catalog request completed" EBS event, sometimes getting the resource is error out and block subscription is not really working. Can you give more details about the trigger mechanism to handover the requests?
If you use Blocking for Catalog Item Request Completed the catalog resource will not be available until that blocking subscription completes. Unfortunately the item is not in the inventory until the entire lifecycle is completed. The behaviour is different in vRA 8.0.
Have a look at the OOTB workflow from the vRA Plugin
Library / vRealize Automation / Requests / Wait for catalog item Request
It shows how to create a trigger for the Submitted Request and how to handle the result when it fires.
At the moment I have an XaaS workflow which the provides the User with a form to request their server. When they submit that request, the workflow customizes the IaaS CatalogItem request and submits that as a privileged service account user. The trigger wait is used to do the following
- Keep the XaaS request as InProgress
- Wait until the IaaS trigger fires
- Assess the IaaS result and locate the Deployment to report the name, IP address etc in an email
I use the trigger to keep the XaaS running and to let me know when the IaaS is completed. As I said above, I noticed that there is a delay between the trigger firing to say IaaS completed and the Deployment resource appearing in the Catalaog.
I will check by not using the Blocking setting. But, when it fails to get the resourceId using deploymentId it never gets the resourceId even after trying some hours/days.
I have also tried when "Deployment action completed" which works for sometime and fails often.