Skip to content

Commit

Permalink
Warning fixes.
Browse files Browse the repository at this point in the history
Fix another shadow warning.

Modify unused variable names in multi-splat.

More shadow warning fixes.

Fix shadowed variable warnings.
  • Loading branch information
Daniel Berger authored and djberg96 committed Apr 23, 2019
1 parent 03a0cff commit 93d5f5d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/models/condition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def self._subst_find(rec, expr)

listexp = /<value([^>]*)>(.+)<\/value>/im
search =~ listexp
opts, ref, object = options2hash($1, rec)
opts, _ref, _object = options2hash($1, rec)
methods = $2.split("/")
methods.shift
methods.shift
Expand Down
4 changes: 2 additions & 2 deletions app/models/miq_request_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/models/miq_schedule_worker/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions app/models/miq_snmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/models/vm_or_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/models/miq_queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 93d5f5d

Please sign in to comment.