Class: ForemanRhCloud::RulesIngester

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_rh_cloud/rules_ingester.rb

Instance Method Summary collapse

Instance Method Details

#ingest_rules_and_resolutions!Object



3
4
5
6
7
8
9
10
# File 'app/services/foreman_rh_cloud/rules_ingester.rb', line 3

def ingest_rules_and_resolutions!
  rules, resolutions = fetch_rules_and_resolutions
  # rubocop:disable Rails/SkipsModelValidations
  ::InsightsRule.upsert_all(rules, unique_by: :rule_id)
  ::InsightsResolution.delete_all
  ::InsightsResolution.insert_all(resolutions)
  # rubocop:enable Rails/SkipsModelValidations
end