frapposelli / vagrant-vcloud

Vagrant provider for VMware vCloud Director®
MIT License
67 stars 38 forks source link

failure detecting deleted vapp #108

Closed bjtucker closed 3 years ago

bjtucker commented 9 years ago

In my testing, I put my vApp in a broken state. I manually deleted the vApp in the web portal, and now I can't get vagrant to recognize it is gone.

Checking the debug, I think I have it a root cause.

"[Tue Nov 25 19:08:14 2014] -> SEND GET https://vcloud.example.com:443/api/vApp/vapp-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" DEBUG read_state: Couldn't Read VM State: Unattended code received 403

vCD gives a 403 when vagrant tries to access the URL for that a deleted vApp, which is not an expected condition.

A possible solution would be to use api/vApps/query and filter for the expected vApp on failure.

the query would look roughly like this:

GET 'https://vcloud.example.com:443/api/vApps/query?filter=href==https://vcloud.example.com:443/api/vApp/vapp-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

it should return a QueryResultRecords element containing a matching VAppRecord element if the vm exists, or a QueryResultRecords element with no VAppRecord if the vm is missing.

It would be dangerous regard a 403 as confirmation that the vApp is missing without checking further, since a login problem will also return 403.

frapposelli commented 9 years ago

thanks for filing this.

dorheini commented 9 years ago

I have this problem also. any work around for this issue untill the release?

Thanks,

StefanScherer commented 9 years ago

A small workaround after deleting a complete vApp is just to remove the local .vagrant directory beside the Vagrantfile. After that Vagrant forgets anything about the vApp ID and machine ID's and you can continue with a vagrant up --provider vcloud.