Skip to content

Commit

Permalink
For #132: catch an exception when the arbiter module got services for…
Browse files Browse the repository at this point in the history
… unknown hosts
  • Loading branch information
mohierf committed Dec 7, 2017
1 parent dd38bb2 commit dc66b38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion alignak_module_backend/arbiter/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,11 @@ def get_services(self):

for service in all_services['_items']:
# Get host name from the previously loaded hosts list
service['host_name'] = self.configraw['hosts'][service['host']]
try:
service['host_name'] = self.configraw['hosts'][service['host']]
except KeyError:
logger.warning("Got a service for an unknown host")
continue
logger.debug("- %s/%s", service['host_name'], service['name'])
self.configraw['services'][service['_id']] = service['name']
service['imported_from'] = u'alignak-backend'
Expand Down

0 comments on commit dc66b38

Please sign in to comment.