From e3b921d50810671ac218ce4967011a2498aee09c Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 20 Jun 2024 10:55:54 -0400 Subject: [PATCH] SAT-22626 - Log rule response on insights sync and dont fail (#890) --- lib/insights_cloud/async/insights_resolutions_sync.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/insights_cloud/async/insights_resolutions_sync.rb b/lib/insights_cloud/async/insights_resolutions_sync.rb index cba4e38b..064c25ba 100644 --- a/lib/insights_cloud/async/insights_resolutions_sync.rb +++ b/lib/insights_cloud/async/insights_resolutions_sync.rb @@ -60,7 +60,13 @@ def to_resolution_hash(rule_id, resolution_hash) def write_resolutions(response) all_resolutions = response.map do |rule_id, rule_details| - rule_details['resolutions'].map { |resolution| to_resolution_hash(to_rule_id(rule_id), resolution) } + if rule_details + rule_details['resolutions'].map { |resolution| to_resolution_hash(to_rule_id(rule_id), resolution) } + else + logger.info("Rules response: #{rule_id} #{rule_details}") + logger.debug("Response: #{response}\n Failed id #{rule_id}") + [] + end end.flatten InsightsResolution.create(all_resolutions)