diff --git a/.rubocop_local.yml b/.rubocop_local.yml index a19c49f72..0066b4267 100644 --- a/.rubocop_local.yml +++ b/.rubocop_local.yml @@ -1,2 +1,4 @@ -# GlobalVars: -# AllowedVariables: +GlobalVars: + AllowedVariables: + # Loggers + - $vcloud_log diff --git a/app/models/manageiq/providers/vmware/cloud_manager.rb b/app/models/manageiq/providers/vmware/cloud_manager.rb index a7fea3c2b..14f8065b5 100644 --- a/app/models/manageiq/providers/vmware/cloud_manager.rb +++ b/app/models/manageiq/providers/vmware/cloud_manager.rb @@ -60,24 +60,24 @@ def supported_catalog_types def vm_start(vm, _options = {}) vm.start rescue => err - _log.error "vm=[#{vm.name}, error: #{err}" + $vcloud_log.error("vm=[#{vm.name}, error: #{err}") end def vm_stop(vm, _options = {}) vm.stop rescue => err - _log.error "vm=[#{vm.name}, error: #{err}" + $vcloud_log.error("vm=[#{vm.name}, error: #{err}") end def vm_suspend(vm, _options = {}) vm.suspend rescue => err - _log.error "vm=[#{vm.name}], error: #{err}" + $vcloud_log.error("vm=[#{vm.name}], error: #{err}") end def vm_restart(vm, _options = {}) vm.restart rescue => err - _log.error "vm=[#{vm.name}], error: #{err}" + $vcloud_log.error("vm=[#{vm.name}], error: #{err}") end end diff --git a/app/models/manageiq/providers/vmware/cloud_manager/event_catcher/stream.rb b/app/models/manageiq/providers/vmware/cloud_manager/event_catcher/stream.rb index 2a96a6219..043213f91 100644 --- a/app/models/manageiq/providers/vmware/cloud_manager/event_catcher/stream.rb +++ b/app/models/manageiq/providers/vmware/cloud_manager/event_catcher/stream.rb @@ -41,7 +41,7 @@ def initialize(options = {}) end def start - _log.debug("Opening amqp connection to #{@options}") + $vcloud_log.debug("Opening amqp connection to #{@options}") connection.start @channel = connection.create_channel initialize_queues(@channel) @@ -76,7 +76,7 @@ def initialize_queues(channel) begin @queues[queue_name] = channel.queue(queue_name, :durable => true) rescue Bunny::AccessRefused => err - _log.warn("Could not start listening to queue '#{queue_name}' due to: #{err}") + $vcloud_log.warn("Could not start listening to queue '#{queue_name}' due to: #{err}") end end end @@ -96,7 +96,7 @@ def listen_queues end end rescue => e - _log.error("Exception receiving Rabbit (amqp)"\ + $vcloud_log.error("Exception receiving Rabbit (amqp)"\ " event on #{queue_name} from #{@options[:hostname]}: #{e}") end end diff --git a/app/models/manageiq/providers/vmware/cloud_manager/event_catcher_mixin.rb b/app/models/manageiq/providers/vmware/cloud_manager/event_catcher_mixin.rb index e60f5cfa2..4fcc12e4a 100644 --- a/app/models/manageiq/providers/vmware/cloud_manager/event_catcher_mixin.rb +++ b/app/models/manageiq/providers/vmware/cloud_manager/event_catcher_mixin.rb @@ -45,15 +45,15 @@ def monitor_events def stop_event_monitor @event_monitor_handle.stop unless @event_monitor_handle.nil? rescue StandardException => err - _log.warn("Event Monitor Stop errored because [#{err.message}]") - _log.warn("Error details: [#{err.details}]") - _log.log_backtrace(err) + $vcloud_log.warn("Event Monitor Stop errored because [#{err.message}]") + $vcloud_log.warn("Error details: [#{err.details}]") + $vcloud_log.log_backtrace(err) ensure reset_event_monitor_handle end def queue_event(event) - _log.info "Caught event [#{event.type}]" + $vcloud_log.info("Caught event [#{event.type}]") event_hash = ManageIQ::Providers::Vmware::CloudManager::EventParser.event_to_hash(event, @cfg[:ems_id]) EmsEvent.add_queue('add', @cfg[:ems_id], event_hash) end diff --git a/app/models/manageiq/providers/vmware/cloud_manager/orchestration_stack.rb b/app/models/manageiq/providers/vmware/cloud_manager/orchestration_stack.rb index 834457c6c..29583b532 100644 --- a/app/models/manageiq/providers/vmware/cloud_manager/orchestration_stack.rb +++ b/app/models/manageiq/providers/vmware/cloud_manager/orchestration_stack.rb @@ -8,7 +8,7 @@ def self.raw_create_stack(orchestration_manager, stack_name, template, options = service.instantiate_template(create_options) end rescue => err - _log.error "stack=[#{stack_name}], error: #{err}" + $vcloud_log.error("stack=[#{stack_name}], error: #{err}") raise MiqException::MiqOrchestrationProvisionError, err.to_s, err.backtrace end @@ -23,7 +23,7 @@ def raw_delete_stack raw_stack.destroy end rescue => err - _log.error "stack=[#{name}], error: #{err}" + $vcloud_log.error("stack=[#{name}], error: #{err}") raise MiqException::MiqOrchestrationDeleteError, err.to_s, err.backtrace end @@ -38,7 +38,7 @@ def raw_status rescue MiqException::MiqOrchestrationStackNotExistError raise rescue => err - _log.error("stack=[#{name}], error: #{err}") + $vcloud_log.error("stack=[#{name}], error: #{err}") raise MiqException::MiqOrchestrationStatusError, err.to_s, err.backtrace end end diff --git a/app/models/manageiq/providers/vmware/cloud_manager/refresh_parser.rb b/app/models/manageiq/providers/vmware/cloud_manager/refresh_parser.rb index 954663ba2..7141b35eb 100644 --- a/app/models/manageiq/providers/vmware/cloud_manager/refresh_parser.rb +++ b/app/models/manageiq/providers/vmware/cloud_manager/refresh_parser.rb @@ -18,7 +18,7 @@ def initialize(ems, options = nil) def ems_inv_to_hashes log_header = "MIQ(#{self.class.name}.#{__method__}) Collecting data for EMS name: [#{@ems.name}] id: [#{@ems.id}]" - $log.info("#{log_header}...") + $vcloud_log.info("#{log_header}...") get_ems get_orgs @@ -28,7 +28,7 @@ def ems_inv_to_hashes get_vapp_templates get_images - $log.info("#{log_header}...Complete") + $vcloud_log.info("#{log_header}...Complete") @data end diff --git a/app/models/manageiq/providers/vmware/manager_auth_mixin.rb b/app/models/manageiq/providers/vmware/manager_auth_mixin.rb index 9dc08c5ab..7c644ca2d 100644 --- a/app/models/manageiq/providers/vmware/manager_auth_mixin.rb +++ b/app/models/manageiq/providers/vmware/manager_auth_mixin.rb @@ -62,7 +62,7 @@ def connection_rescue_block yield rescue => err miq_exception = translate_exception(err) - _log.error("Error Class=#{err.class.name}, Message=#{err.message}") + $vcloud_log.error("Error Class=#{err.class.name}, Message=#{err.message}") raise miq_exception end diff --git a/app/models/manageiq/providers/vmware/network_manager/refresh_parser.rb b/app/models/manageiq/providers/vmware/network_manager/refresh_parser.rb index 07e4b1331..19789ddf7 100644 --- a/app/models/manageiq/providers/vmware/network_manager/refresh_parser.rb +++ b/app/models/manageiq/providers/vmware/network_manager/refresh_parser.rb @@ -16,12 +16,12 @@ def initialize(ems, options = nil) def ems_inv_to_hashes log_header = "MIQ(#{self.class.name}.#{__method__}) Collecting data for EMS name: [#{@ems.name}] id: [#{@ems.id}]" - $log.info("#{log_header}...") + $vcloud_log.info("#{log_header}...") get_networks get_network_ports - $log.info("#{log_header}...Complete") + $vcloud_log.info("#{log_header}...Complete") @data end