From f92cf4dbe00f4249f4efeb86886394cab324019a Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Wed, 13 Dec 2017 11:46:50 -0600 Subject: rest_dbus.py: Fix UnknownInterface error The string "org.freedesktop.UnknownInterface" is not an existing dbus error string, all errors are of format *.DBus.Error.* so remove it. Also check the dbus name instead of message for this error. The dbus message is the description of the error, like "Unknown interface 'foo'". The dbus name is the actual error string, like "org.freedesktop.DBus.Error.UnknownInterface", Change-Id: Ib54adef852713bc30f3eefc6598e28fcf5be3d29 Signed-off-by: Adriana Kobylak --- module/obmc/wsgi/apps/rest_dbus.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/module/obmc/wsgi/apps/rest_dbus.py b/module/obmc/wsgi/apps/rest_dbus.py index b47ea4e..0ea921e 100644 --- a/module/obmc/wsgi/apps/rest_dbus.py +++ b/module/obmc/wsgi/apps/rest_dbus.py @@ -40,8 +40,7 @@ if have_wsock: import gobject import gevent -DBUS_UNKNOWN_INTERFACE = 'org.freedesktop.UnknownInterface' -DBUS_UNKNOWN_INTERFACE_ERROR = 'org.freedesktop.DBus.Error.UnknownInterface' +DBUS_UNKNOWN_INTERFACE = 'org.freedesktop.DBus.Error.UnknownInterface' DBUS_UNKNOWN_METHOD = 'org.freedesktop.DBus.Error.UnknownMethod' DBUS_INVALID_ARGS = 'org.freedesktop.DBus.Error.InvalidArgs' DBUS_TYPE_ERROR = 'org.freedesktop.DBus.Python.TypeError' @@ -244,10 +243,7 @@ class RouteHandler(object): try: return f(*a) except dbus.exceptions.DBusException, e: - if DBUS_UNKNOWN_INTERFACE in e.get_dbus_message(): - # interface doesn't have any properties - return None - if DBUS_UNKNOWN_INTERFACE_ERROR in e.get_dbus_name(): + if DBUS_UNKNOWN_INTERFACE in e.get_dbus_name(): # interface doesn't have any properties return None if DBUS_UNKNOWN_METHOD == e.get_dbus_name(): -- cgit v1.2.1