displague / vagrant-linode

A Vagrant plugin that adds a Linode provider to Vagrant, allowing Vagrant to control and provision Linodes.
MIT License
124 stars 23 forks source link

log linodeapi error details #84

Closed cromega closed 6 years ago

cromega commented 6 years ago

I made this change as part of implementing volumes handling.

The plugin would not print useful API error details. This PR addresses #83.

Original output:

==> image_builder: Linode has not been created
==> image_builder: Creating a new linode...
==> image_builder: Created a new linode... 4566322, https://manager.linode.com/linodes/dashboard/linode4566322
/home/crome/.vagrant.d/gems/2.3.3/gems/linodeapi-2.0.1/lib/linodeapi/helpers.rb:23:in `parse': API Error encountered (LinodeAPI::APIError)

With error handling:

==> image_builder: Linode has not been created
==> image_builder: Creating a new linode...
==> image_builder: Created a new linode... 4566322, https://manager.linode.com/linodes/dashboard/linode4566322
==> image_builder: [{"ERRORMESSAGE"=>"The Block Storage beta is currently at capacity. Please try again later.", "ERRORCODE"=>8}]
/home/crome/.vagrant.d/gems/2.3.3/gems/linodeapi-2.0.1/lib/linodeapi/helpers.rb:23:in `parse': API Error encountered (LinodeAPI::APIError)