Skip to content

Commit

Permalink
Fixes #36914 - skip missing hosts during applicability generate
Browse files Browse the repository at this point in the history
  • Loading branch information
ianballou committed Nov 14, 2023
1 parent 9b51612 commit a07ff62
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/lib/actions/katello/applicability/hosts/bulk_generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,24 @@ class BulkGenerate < Actions::EntryAction
end

def run
error = false
input[:host_ids].each do |host_id|
content_facet = ::Katello::Host::ContentFacet.find_by_host_id(host_id)
if content_facet.present?
# Catch errors and log them, but continue processing the rest of the hosts
content_facet.calculate_and_import_applicability
else
Rails.logger.warn(_("Content Facet for host with id %s is non-existent. Skipping applicability calculation.") % host_id)
end
rescue NoMethodError, PG::Error => e
Rails.logger.error("Error calculating applicability for host #{host_id}: #{e.message}")
error = true
end
raise "Error calculating applicability for one or more hosts" if error
end

def rescue_strategy
Dynflow::Action::Rescue::Skip
end

def queue
Expand Down

0 comments on commit a07ff62

Please sign in to comment.