server: Improve discovery failure handling
Display the failing service and path.
Display the traceback of the original error.
Don't wait forever to claim a bus name after a failure.
Change-Id: I2bf0f0ee29d4fe838eae215590fad7d4b2ef0c7c
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/obmc/mapper/server.py b/obmc/mapper/server.py
index 07830e3..2944ddf 100644
--- a/obmc/mapper/server.py
+++ b/obmc/mapper/server.py
@@ -24,6 +24,8 @@
import obmc.mapper
import obmc.dbuslib.bindings
import obmc.dbuslib.enums
+import sys
+import traceback
class MapperBusyException(dbus.exceptions.DBusException):
@@ -293,8 +295,17 @@
self.IntrospectionComplete(owner)
def discovery_error(self, owner, path, e):
+ '''Log a message and remove all traces of the service
+ we were attempting to introspect.'''
+
if owner in self.defer_signals:
- raise e
+ sys.stderr.write(
+ '{} discovery failure on {}\n'.format(
+ self.bus_map.get(owner, owner),
+ path))
+ traceback.print_exception(*sys.exc_info())
+ del self.defer_signals[owner]
+ del self.bus_map[owner]
def cache_get(self, path):
cache_entry = self.cache.get(path, {})