ManageIQ / manageiq-api-client

Ruby client library to the ManageIQ REST API
MIT License
11 stars 26 forks source link

Bad error when failing connectivity #120

Closed kbrock closed 5 months ago

kbrock commented 5 months ago

Connecting to a server that is not available throws a strange exception:

manageiq-api-client-0.4.0/lib/manageiq/api/client/connection.rb:112:in `raise': exception class/object expected (TypeError)
  raise @error.message
        ^^^^^^^^^^^^^^
from manageiq-api-client-0.4.0/lib/manageiq/api/client/connection.rb:112:in `check_response'
from manageiq-api-client-0.4.0/lib/manageiq/api/client/connection.rb:103:in `send_request'
from manageiq-api-client-0.4.0/lib/manageiq/api/client/connection.rb:24:in `get'
from manageiq-api-client-0.4.0/lib/manageiq/api/client/client.rb:37:in `load_definitions'
from manageiq-api-client-0.4.0/lib/manageiq/api/client/client.rb:62:in `reconnect'
from manageiq-api-client-0.4.0/lib/manageiq/api/client/client.rb:33:in `initialize'

I was following the example in https://github.com/ManageIQ/workflows-examples/blob/master/provision-vm-service/README.md - local development step 3

kbrock commented 5 months ago

The solution to the above problem ends up adding the hostname to rails:

diff --git a/config/environments/development.rb b/config/environments/development.rb
index 760b8323d3..631c30b1e6 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -59,3 +59,5 @@ Vmdb::Application.configure do
   # Allow nip.io for development with external auth where hostnames are required
   config.hosts << "127.0.0.1.nip.io"
+  # allow docker to connect to this host
+  config.hosts << "host.docker.internal"
 end
kbrock commented 5 months ago

fixed by #121