Bug #15539
open
ENC node.rb fails to return cached yaml when server is unreachable
Added by Greg Koch over 8 years ago.
Updated over 7 years ago.
Description
When the Foreman server is down/unreachable the node.rb ENC script will return 1 with an error message of
Error retrieving node da1haln01pe.stsky.biz: Net::HTTPServiceUnavailable
Check Foreman's /var/log/foreman/production.log for more information.
Adding "RuntimeError" to the list of rescues on line 347 fixes the issue.
rescue TimeoutError, SocketError, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, RuntimeError
This is the version of node.rb I am using: https://github.com/theforeman/puppet-foreman/blob/master/files/external_node_v2.rb
I was helping to debug this on IRC - it seems that
- the Apache server is still up but serving Service Unavailable, so we're not hitting the timeout
- line 199 is consuming the real error code and raising RuntimeError instead
We should probably rewrite line 199 to pass the real error type up the stack and then add Net::HTTPServiceUnavailable to the list of rescues on line 347
- Pull request https://github.com/theforeman/puppet-foreman/pull/460 added
I applied this PR to our puppet masters. At this point we have apache up but requests to it are timing out and node.rb now returns
Could not send facts to Foreman: Net::ReadTimeout
instead of using the cache.
And when Apache is stopped, we receive the following, again ignoring the cache:
Error retrieving node node.example.com: Net::HTTPServiceUnavailableCheck Foreman's /var/log/foreman/production.log for more information.
- Status changed from New to Ready For Testing
- Assignee set to Daniel Lobato Garcia
- Status changed from Ready For Testing to New
- Assignee deleted (
Daniel Lobato Garcia)
- Pull request deleted (
https://github.com/theforeman/puppet-foreman/pull/460)
Also available in: Atom
PDF