Skip to content

Commit

Permalink
Update Network Refresh error logging for not-OpenStack provider
Browse files Browse the repository at this point in the history
A logic for catch/rescue errors for refresh uses @os_handle for warn logging.
RHV/ovirt provider uses OpenStack networking, but doesn't provide @os_handle.

Updating warn error output to use @manager variable with ignore if nil to allow
pass refresh even with skipped records (as until how, just logging raised the error).

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1815479
  • Loading branch information
aufi committed Apr 3, 2020
1 parent 44a40c9 commit e2eb354
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ def safe_call
yield
rescue Excon::Errors::Forbidden => err
# It can happen user doesn't have rights to read some tenant, in that case log warning but continue refresh
_log.warn "Forbidden response code returned in provider: #{@os_handle.address}. Message=#{err.message}"
_log.warn "Forbidden response code returned in provider: #{@manager&.hostname}. Message=#{err.message}"
_log.warn err.backtrace.join("\n")
nil
rescue Excon::Errors::Unauthorized => err
# It can happen user doesn't have rights to read some tenant, in that case log warning but continue refresh
_log.warn "Unauthorized response code returned in provider: #{@os_handle.address}. Message=#{err.message}"
_log.warn "Unauthorized response code returned in provider: #{@manager&.hostname}. Message=#{err.message}"
_log.warn err.backtrace.join("\n")
nil
rescue Excon::Errors::NotFound, Fog::Errors::NotFound => err
# It can happen that some data do not exist anymore,, in that case log warning but continue refresh
_log.warn "Not Found response code returned in provider: #{@os_handle.address}. Message=#{err.message}"
_log.warn "Not Found response code returned in provider: #{@manager&.hostname}. Message=#{err.message}"
_log.warn err.backtrace.join("\n")
nil
rescue Excon::Errors::BadRequest => err
# This can happen if stack resources are missing, among other reasons. In such a case log a warning but continue the refresh.
_log.warn "Bad Request response code returned in provider: #{@os_handle.address}. Message=#{err.message}"
_log.warn "Bad Request response code returned in provider: #{@manager&.hostname}. Message=#{err.message}"
_log.warn err.backtrace.join("\n")
nil
end
Expand Down

0 comments on commit e2eb354

Please sign in to comment.