Skip to content

Commit

Permalink
Fix Rails/FindEach cop
Browse files Browse the repository at this point in the history
  • Loading branch information
archanaserver committed Jan 16, 2024
1 parent 16f4938 commit 351bab4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v2/discovered_hosts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def auto_provision_all

total_count = 0
overall_errors = ""
Host::Discovered.all.each do |discovered_host|
Host::Discovered.all.find_each do |discovered_host|
if rule = find_discovery_rule(discovered_host)
result &= perform_auto_provision(discovered_host, rule)
unless discovered_host.errors.empty?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class FakeDiscoveredHost < ApplicationRecord

class FillDiscoveryAttributeSetsForExistingHosts < ActiveRecord::Migration[4.2]
def up
FakeDiscoveredHost.where(:type => "Host::Discovered").all.each do |host|
FakeDiscoveredHost.where(:type => "Host::Discovered").all.find_each do |host|
begin
say "Populating attribute set for discovered host #{host.name}"
ForemanDiscovery::ImportHooks::DiscoveryAttribute.new(host: host, facts: host.facts_hash).after_populate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class RemoveOldDiscoveryReaderPermissions < ActiveRecord::Migration[4.2]
def up
Permission.where("name like '%_discovery_rules' and resource_type is null").each do |permission|
Permission.where("name like '%_discovery_rules' and resource_type is null").find_each do |permission|
permission.update(:resource_type => 'DiscoveryRule')
end
end
Expand Down

0 comments on commit 351bab4

Please sign in to comment.