frapposelli / vagrant-vcloud

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

Show XML error message, fix for #88 #89

Closed StefanScherer closed 10 years ago

StefanScherer commented 10 years ago

Here is a fix for #88. In case of HTTP 400 response, it will parse the XML response.body and read the message attribute and append that to the message raised.

The error from #88 now looks like this, even without debug logging:

C:\jenkins\workspace\windows_2008_r2-100gb_vcloud\boxtest>vagrant up --provider=vcloud
Bringing machine 'default' up with 'vcloud' provider...
==> default: Building vApp...
==> default: vApp windows_2008_r2-100gb-vagrant-vmware-slave-615ef4a5 successfully created.
C:/Users/vagrant/.vagrant.d/gems/gems/vagrant-vcloud-0.4.0/lib/vagrant-vcloud/driver/base.rb:356:in
`send_request': Warning: unattended code 400 Bad Request: Guest customization requires at least version
7299 of VMware tools. You can deselect 'Enable guest customization' for now and select it after installing
VMware tools to perform guest customization. (RuntimeError)

Now it is easier to find what caused the problem.

I have also added the intense logging if debug logging is turned on, so also there the response appears with header and body.

StefanScherer commented 10 years ago

Cleaned up the PR a little bit, and with some further testing I now see my other favorite error:

$ vagrant up --provider=vcloud
Bringing machine 'tst' up with 'vcloud' provider...
Bringing machine 'tst2' up with 'vcloud' provider...
==> tst: Building vApp...
/Users/stefan/.vagrant.d/gems/gems/vagrant-vcloud-0.4.0/lib/vagrant-vcloud/driver/base.rb:373:in `send_request': Warning: unattended code 400 Bad Request: The requested operation will exceed the VDC's storage quota. (RuntimeError)

Out of VDC's storage quota ;-)

frapposelli commented 10 years ago

Fixed in 0.4.1