From e2eb354daa2af6b8d778289a7d115774248e2a1f Mon Sep 17 00:00:00 2001 From: Marek Aufart Date: Fri, 3 Apr 2020 15:14:26 +0200 Subject: [PATCH] Update Network Refresh error logging for not-OpenStack provider 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 --- .../openstack/refresh_parser_common/helper_methods.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/manageiq/providers/openstack/refresh_parser_common/helper_methods.rb b/app/models/manageiq/providers/openstack/refresh_parser_common/helper_methods.rb index efac689c7..25c753397 100644 --- a/app/models/manageiq/providers/openstack/refresh_parser_common/helper_methods.rb +++ b/app/models/manageiq/providers/openstack/refresh_parser_common/helper_methods.rb @@ -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