def insert_default_violations_values_for_all_domains( cls, db, default_violations_values, violation_definitions, cache): from holmes.models import Domain domains_violations_prefs = DomainsViolationsPrefs.get_domains_violations_prefs( db) domains = Domain.get_all_domains(db) for domain in domains: domain_data = domains_violations_prefs.get(domain.name, None) if domain_data: keys = set(default_violations_values.keys()) - set( domain_data.keys()) else: keys = default_violations_values.keys() DomainsViolationsPrefs.insert_default_violations_values_for_domain( db, domain, keys, violation_definitions, cache)
def insert_default_violations_values_for_all_domains( cls, db, default_violations_values, violation_definitions, cache): from holmes.models import Domain domains_violations_prefs = DomainsViolationsPrefs.get_domains_violations_prefs(db) domains = Domain.get_all_domains(db) for domain in domains: domain_data = domains_violations_prefs.get(domain.name, None) if domain_data: keys = set(default_violations_values.keys()) - set(domain_data.keys()) else: keys = default_violations_values.keys() DomainsViolationsPrefs.insert_default_violations_values_for_domain( db, domain, keys, violation_definitions, cache )
def load_all_domains_violations_prefs(self): from holmes.models import Domain for domain in Domain.get_all_domains(self.db): self.cache.get_domain_violations_prefs(domain.name)