discoverer: Fix a bug in multiple removals
If we get notifications that a host has been lost twice, we can crash out.
Change-Id: Ifeef72d3c41707187d8f9f95674bbd0997b1e7fe
diff --git a/mdt/discoverer.py b/mdt/discoverer.py
index 715f336..bd080a6 100644
--- a/mdt/discoverer.py
+++ b/mdt/discoverer.py
@@ -42,7 +42,8 @@
if self.listener and hasattr(self.listener, "remove_device"):
self.listener.remove_device(info.server,
self.discoveries[info.server])
- del(self.discoveries[info.server])
+ if info.server in self.discoveries:
+ del(self.discoveries[info.server])
def stop(self):
self.browser.cancel()