Ruby on Rails Tuesday, October 6, 2015

I have the following in a controller method:

begin
response = Net::HTTP.post_form(URI.parse(File.join(@site.url, 'scan_folder.json')), {inlay_key: @site.key})
@response = JSON.parse(response.body.to_s)['remote']
@response_type = 'success'
@site.tested_client = true
@site.save
rescue
@response = 'Could not locate Inlay Client.'
@response_type = 'error'
end

And it seems to work very well. But I have a test site that it is not finding. When I comment out the rescue portion, the error I get indicates that the host could not be found. I have tried adding a line to the hosts file (the way you would on a Mac to do fake DNS for a development site) and this too appears to be ignored completely. The Rails server is running on Ubuntu 14, with all the latest patches, and I even tried rebooting the entire server to get any caches to clear. Dig on the server is able to find the test machine, but Net::HTTP on the same server cannot.

Can anyone offer a direction to start looking? Are there configurations that I could be doing to ensure that lookup is exhaustive before giving up?

Thanks,

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ADD4E544-8785-4E8C-871E-8D33CC0C5324%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment