40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'app/models/discovery_rule.rb', line 40
def enforce_taxonomy
return if hostgroup.nil?
if SETTINGS[:organizations_enabled]
unless (ms = hostgroup.organizations - organizations).empty?
names = ms.collect(&:name).to_sentence
errors.add(:organizations, n_("Host group organization %s must also be associated to the discovery rule", "Host group organizations %s must also be associated to the discovery rule", ms.size) % names)
end
end
if SETTINGS[:locations_enabled]
unless (ms = hostgroup.locations - locations).empty?
names = ms.collect(&:name).to_sentence
errors.add(:locations, n_("Host group location %s must also be associated to the discovery rule", "Host group locations %s must also be associated to the discovery rule", ms.size) % names)
end
end
end
|