diff --git a/app/lib/actions/katello/applicability/hosts/bulk_generate.rb b/app/lib/actions/katello/applicability/hosts/bulk_generate.rb index 131f3e65533..592bee8fc20 100644 --- a/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +++ b/app/lib/actions/katello/applicability/hosts/bulk_generate.rb @@ -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