When running as an ENC not having a connection to the foreman host makes the execution fail, instead of using the cache, since the exception raised by upload_facts is not catched. This patch does three things: - introduce a new exception class for fact upload errors (so we don't have to catch the most generic exception and thus possibly catching to much) - move the execution of that method during ENC run into the logic which handles connection problems by falling back to cached data - additionally catch the new exception in the mentioned logic - print a message to stderr on problems during fact upload, so that at least manual invocation leads to a clue that something is wrong.
node.rb: Use node cache, when fact upload fails
When running as an ENC not having a connection to the foreman
host makes the execution fail, instead of using the cache,
since the exception raised by upload_facts is not catched.
This patch does three things:
- introduce a new exception class for fact upload errors
(so we don't have to catch the most generic exception
and thus possibly catching to much)
- move the execution of that method during ENC run into the
logic which handles connection problems by falling back
to cached data
- additionally catch the new exception in the mentioned
logic
- print a message to stderr on problems during fact upload,
so that at least manual invocation leads to a clue that
something is wrong.
closes GH-492