Skip to content

Commit

Permalink
Fix issue when using duplicate and inheritance (close #1676)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierHa committed Aug 14, 2015
1 parent ec17d07 commit f4dcab2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions shinken/objects/service.py
Expand Up @@ -1754,6 +1754,13 @@ def explode(self, hosts, hostgroups, contactgroups,
# items::explode_trigger_string_into_triggers
self.explode_trigger_string_into_triggers(triggers)

# Explode services that have a duplicate_foreach clause
duplicates = [s.id for s in self if getattr(s, 'duplicate_foreach', '')]
for id in duplicates:
s = self.items[id]
self.explode_services_duplicates(hosts, s)
if not s.configuration_errors:
self.remove_item(s)

# Then for every host create a copy of the service with just the host
# because we are adding services, we can't just loop in it
Expand Down Expand Up @@ -1786,14 +1793,6 @@ def explode(self, hosts, hostgroups, contactgroups,
self.explode_contact_groups_into_contacts(t, contactgroups)
self.explode_services_from_templates(hosts, t)

# Explode services that have a duplicate_foreach clause
duplicates = [s.id for s in self if getattr(s, 'duplicate_foreach', '')]
for id in duplicates:
s = self.items[id]
self.explode_services_duplicates(hosts, s)
if not s.configuration_errors:
self.remove_item(s)

to_remove = []
for service in self:
host = hosts.find_by_name(service.host_name)
Expand Down

0 comments on commit f4dcab2

Please sign in to comment.