Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #36914 - skip missing hosts during applicability generate #10796

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
fail "Error calculating applicability for one or more hosts" if error
end

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

def queue
Expand Down