dbuslib: Fix UnknownInterface error
The string "org.freedesktop.UnknownInterface" is not an
existing dbus error string, all errors are of format
*.DBus.Error.* so change this error string to the right one.
Also fix the error responses when dbus errors are raised.
Part of openbmc/openbmc#2463
Change-Id: I384393a6f81c5057173e2941cd109e2f952e1311
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/obmc/dbuslib/bindings.py b/obmc/dbuslib/bindings.py
index ea0da5c..3eea6a5 100644
--- a/obmc/dbuslib/bindings.py
+++ b/obmc/dbuslib/bindings.py
@@ -58,7 +58,8 @@
return v
except:
raise dbus.exceptions.DBusException(
- "org.freedesktop.UnknownProperty: "+property_name)
+ "Unknown property: '{}'".format(property_name),
+ name="org.freedesktop.DBus.Error.UnknownProperty")
@dbus.service.method(
dbus.PROPERTIES_IFACE,
@@ -69,7 +70,8 @@
return d
except:
raise dbus.exceptions.DBusException(
- "org.freedesktop.UnknownInterface: "+interface_name)
+ "Unknown interface: '{}'".format(interface_name),
+ name="org.freedesktop.DBus.Error.UnknownInterface")
@dbus.service.method(
dbus.PROPERTIES_IFACE,
diff --git a/obmc/dbuslib/enums.py b/obmc/dbuslib/enums.py
index 4ddec42..f1d4d64 100644
--- a/obmc/dbuslib/enums.py
+++ b/obmc/dbuslib/enums.py
@@ -17,7 +17,7 @@
import dbus
DBUS_OBJMGR_IFACE = dbus.BUS_DAEMON_IFACE + '.ObjectManager'
-DBUS_UNKNOWN_INTERFACE = 'org.freedesktop.UnknownInterface'
+DBUS_UNKNOWN_INTERFACE = 'org.freedesktop.DBus.Error.UnknownInterface'
DBUS_UNKNOWN_SERVICE = 'org.freedesktop.DBus.Error.ServiceUnknown'
DBUS_UNKNOWN_PROPERTY = 'org.freedesktop.DBus.Error.UnknownProperty'
DBUS_UNKNOWN_METHOD = 'org.freedesktop.DBus.Error.UnknownMethod'