VMware Cloud Community
rlangenfeld
Contributor
Contributor

How to tell when a VApp is safely stored in a catalog

I was wondering when you are programmatically adding a VApp from the cloud to a Catalog, if it's possible to know when it is done? Sometime the code down below:

CatalogItemType catalogItemType = parameterFactory.getCatalogItemType();

catalogItemType.setName(vAppTemplateName);

catalogItemType.setEntity(vAppTemplate.getReference());

CatalogItem returnedCatalogItem = catalog.addCatalogItem(catalogItemType);

Finishes but the catalog is till capturing that VApp. Is there a way to tell when it's done through waitForTasks() or something else? I've tried getting the tasks off of the VApp but there aren't any. We need to know when it's done so it can be deleted safely from the cloud.

Reply
0 Kudos
5 Replies
rlangenfeld
Contributor
Contributor

I've tried several different things now and no luck. Does anyone have any ideas? This is becoming a major roadblock for me.

Reply
0 Kudos
IamTHEvilONE
Immortal
Immortal

for some reason, I thought there was a status flag on the catalog item.

once you capture, the output of the API call would be the new catalog item url.

Do a get on that URL and check the elements from that.  I thought there was a status (busy) or something similar.

If you are doing this via an SDK or API call, it would be best to post in that dedicated forum: http://communities.vmware.com/community/vmtn/developer/forums/vcloudapi

rlangenfeld
Contributor
Contributor

I couldn't find a flag on the returned item but maybe I'm missing something in the sdk. I will repost this in the other forum like you suggested. Thanks again!

Reply
0 Kudos
rlangenfeld
Contributor
Contributor

Got it to work! I had to get the VappTemplate off of the returned CatalogItem and it had a list of Tasks. I was able to call waitForTasks(0) and it now works beautifully!

Reply
0 Kudos
IamTHEvilONE
Immortal
Immortal

that's kinda what I thought ... the IsBusy is my mind remembering the days of Lab Manager.

Reply
0 Kudos