diff --git a/app/models/condition.rb b/app/models/condition.rb index 2c1adc59fb8..f8da43482a5 100644 --- a/app/models/condition.rb +++ b/app/models/condition.rb @@ -149,7 +149,7 @@ def self._subst_find(rec, expr) listexp = /]*)>(.+)<\/value>/im search =~ listexp - opts, ref, object = options2hash($1, rec) + opts, _ref, _object = options2hash($1, rec) methods = $2.split("/") methods.shift methods.shift diff --git a/app/models/miq_request_workflow.rb b/app/models/miq_request_workflow.rb index 2f18ba015d6..8b87733ac60 100644 --- a/app/models/miq_request_workflow.rb +++ b/app/models/miq_request_workflow.rb @@ -370,8 +370,8 @@ def ws_tags(tag_string, parser = :parse_ws_string) # Tags are passed as category|value. Example: cc|001|environment|test ws_tags = send(parser, tag_string) - tags = allowed_tags.each_with_object({}) do |v, tags| - tags[v[:name]] = v[:children].each_with_object({}) { |(k, v), tc| tc[v[:name]] = k } + tags = allowed_tags.each_with_object({}) do |h, atags| + atags[h[:name]] = h[:children].each_with_object({}) { |(k, v), tc| tc[v[:name]] = k } end ws_tags.collect { |cat, tag| tags.fetch_path(cat.to_s.downcase, tag.downcase) }.compact diff --git a/app/models/miq_schedule_worker/runner.rb b/app/models/miq_schedule_worker/runner.rb index 4db7d5e94e0..aa5de96b314 100644 --- a/app/models/miq_schedule_worker/runner.rb +++ b/app/models/miq_schedule_worker/runner.rb @@ -230,8 +230,8 @@ def schedules_for_scheduler_role :first_at => time_at ) { enqueue(:storage_scan_timer) } - schedule_settings_for_ems_refresh.each do |klass, every| - scheduler.schedule_every(every, :first_in => every) do + schedule_settings_for_ems_refresh.each do |klass, local_every| + scheduler.schedule_every(every, :first_in => local_every) do enqueue([:ems_refresh_timer, klass]) end end diff --git a/app/models/miq_snmp.rb b/app/models/miq_snmp.rb index 6fb59078eb6..2f0981b4bf6 100644 --- a/app/models/miq_snmp.rb +++ b/app/models/miq_snmp.rb @@ -53,9 +53,9 @@ def self.trap_v1(inputs) vars = create_var_bind_list(object_list) hosts = host.kind_of?(Array) ? host : [host] - hosts.each do |host| - _log.info("Sending SNMP Trap (v1) to host=[#{host}], port=[#{port}], enterprise_id=[#{enterprise}], generic_trap=[#{generic_trap}], specific_trap=[#{specific_trap}], uptime=[#{uptime}], agent=[#{agent_address}], vars=#{vars.inspect}") - SNMP::Manager.open(:Host => host, :TrapPort => port) do |manager| + hosts.each do |lhost| + _log.info("Sending SNMP Trap (v1) to host=[#{lhost}], port=[#{port}], enterprise_id=[#{enterprise}], generic_trap=[#{generic_trap}], specific_trap=[#{specific_trap}], uptime=[#{uptime}], agent=[#{agent_address}], vars=#{vars.inspect}") + SNMP::Manager.open(:Host => lhost, :TrapPort => port) do |manager| manager.trap_v1(enterprise, agent_address, generic_trap, specific_trap, uptime, vars) end end @@ -79,9 +79,9 @@ def self.trap_v2(inputs) vars = create_var_bind_list(object_list, trap_oid) hosts = host.kind_of?(Array) ? host : [host] - hosts.each do |host| - _log.info("Sending SNMP Trap (v2) to host=[#{host}], port=[#{port}], trap_oid=[#{trap_oid}], vars=#{vars.inspect}") - SNMP::Manager.open(:Host => host, :TrapPort => port) do |manager| + hosts.each do |lhost| + _log.info("Sending SNMP Trap (v2) to host=[#{lhost}], port=[#{port}], trap_oid=[#{trap_oid}], vars=#{vars.inspect}") + SNMP::Manager.open(:Host => lhost, :TrapPort => port) do |manager| manager.trap_v2(uptime, trap_oid, vars) end end diff --git a/app/models/vm_or_template.rb b/app/models/vm_or_template.rb index 0209b305786..09aa9276d41 100644 --- a/app/models/vm_or_template.rb +++ b/app/models/vm_or_template.rb @@ -225,7 +225,7 @@ class VmOrTemplate < ApplicationRecord } REQUIRED_ADVANCED_SETTINGS.each do |k, (m, t)| define_method(m) do - as = advanced_settings.detect { |as| as.name == k } + as = advanced_settings.detect { |setting| setting.name == k } return nil if as.nil? || as.value.nil? return case t @@ -1185,7 +1185,7 @@ def self.assign_ems_created_on(vm_ids) # Loop through the found VM's and set their create times found.each do |vmh| - v = vms_to_update.detect { |v| v.id == vmh[:id] } + v = vms_to_update.detect { |vm| vm.id == vmh[:id] } v.update_attribute(:ems_created_on, vmh[:created_time]) end end diff --git a/spec/models/miq_queue_spec.rb b/spec/models/miq_queue_spec.rb index 80d2917b52f..be57202fb9b 100644 --- a/spec/models/miq_queue_spec.rb +++ b/spec/models/miq_queue_spec.rb @@ -371,7 +371,7 @@ end it "should skip putting message on queue in maintenance zone" do - msg = MiqQueue.put( + MiqQueue.put( :class_name => 'MyClass', :method_name => 'method1', :args => [1, 2],