summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Martinsons <frederic.martinsons@sigfox.com>2020-10-27 14:39:30 +0100
committerThomas Haller <thaller@redhat.com>2020-10-29 09:35:06 +0100
commitf2251487540095af98c52709bf9ff1eb4a79df69 (patch)
treed2258e34c76070c06eeae286b1f5b79149c1ed37
parent7bc01ea14c32976f89346748d2f2b6f82561362b (diff)
downloadNetworkManager-f2251487540095af98c52709bf9ff1eb4a79df69.tar.gz
Initialize correctly _dbus_error_name in BusErr classes
To be consistent with dbus.DbusException classes which do the following in __init__: def __init__(self, *args, **kwargs): name = kwargs.pop('name', None) if name is not None or getattr(self, '_dbus_error_name', None) is None: self._dbus_error_name = name if kwargs: raise TypeError('DBusException does not take keyword arguments: %s' % ', '.join(kwargs.keys())) Exception.__init__(self, *args) Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
-rwxr-xr-xtools/test-networkmanager-service.py56
1 files changed, 42 insertions, 14 deletions
diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py
index 653ddc9132..bcb7be0820 100755
--- a/tools/test-networkmanager-service.py
+++ b/tools/test-networkmanager-service.py
@@ -406,46 +406,74 @@ IFACE_DHCP6_CONFIG = "org.freedesktop.NetworkManager.DHCP6Config"
class BusErr:
class UnknownInterfaceException(dbus.DBusException):
- _dbus_error_name = IFACE_DBUS + ".UnknownInterface"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.UnknownInterface".format(IFACE_DBUS)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class UnknownPropertyException(dbus.DBusException):
- _dbus_error_name = IFACE_DBUS + ".UnknownProperty"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.UnknownProperty".format(IFACE_DBUS)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class InvalidPropertyException(dbus.DBusException):
- _dbus_error_name = IFACE_CONNECTION + ".InvalidProperty"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.InvalidProperty".format(IFACE_CONNECTION)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class MissingPropertyException(dbus.DBusException):
- _dbus_error_name = IFACE_CONNECTION + ".MissingProperty"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.MissingProperty".format(IFACE_CONNECTION)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class InvalidSettingException(dbus.DBusException):
- _dbus_error_name = IFACE_CONNECTION + ".InvalidSetting"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.InvalidSetting".format(IFACE_CONNECTION)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class MissingSettingException(dbus.DBusException):
- _dbus_error_name = IFACE_CONNECTION + ".MissingSetting"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.MissingSetting".format(IFACE_CONNECTION)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class NotSoftwareException(dbus.DBusException):
- _dbus_error_name = IFACE_DEVICE + ".NotSoftware"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.NotSoftware".format(IFACE_DEVICE)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class ApNotFoundException(dbus.DBusException):
- _dbus_error_name = IFACE_WIFI + ".AccessPointNotFound"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.AccessPointNotFound".format(IFACE_WIFI)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class PermissionDeniedException(dbus.DBusException):
- _dbus_error_name = IFACE_NM + ".PermissionDenied"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.PermissionDenied".format(IFACE_NM)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class UnknownDeviceException(dbus.DBusException):
- _dbus_error_name = IFACE_NM + ".UnknownDevice"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.UnknownDevice".format(IFACE_NM)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class UnknownConnectionException(dbus.DBusException):
- _dbus_error_name = IFACE_NM + ".UnknownConnection"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.UnknownConnection".format(IFACE_NM)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class InvalidHostnameException(dbus.DBusException):
- _dbus_error_name = IFACE_SETTINGS + ".InvalidHostname"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.InvalidHostname".format(IFACE_SETTINGS)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class NoSecretsException(dbus.DBusException):
- _dbus_error_name = IFACE_AGENT_MANAGER + ".NoSecrets"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.NoSecrets".format(IFACE_AGENT_MANAGER)
+ dbus.DBusException.__init__(self, *args, **kwargs)
class UserCanceledException(dbus.DBusException):
- _dbus_error_name = IFACE_AGENT_MANAGER + ".UserCanceled"
+ def __init__(self, *args, **kwargs):
+ self._dbus_error_name = "{}.UserCanceled".format(IFACE_AGENT_MANAGER)
+ dbus.DBusException.__init__(self, *args, **kwargs)
@staticmethod
def from_nmerror(e):