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)