Skip to content

Commit

Permalink
SAT-22626 - Log rule response on insights sync and dont fail (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris1984 authored Jun 20, 2024
1 parent 11aedca commit e3b921d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/insights_cloud/async/insights_resolutions_sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e3b921d

Please sign in to comment.