diff options
author | Dan Winship <danw@gnome.org> | 2014-10-15 14:55:41 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-10-22 08:29:08 -0400 |
commit | 9c67b6fb08e4b2794ccab461f0ac9a6cffac33ee (patch) | |
tree | de9c44c0aecb5fe63b431fb3076645a788c8dd03 /tools | |
parent | b1bcfa8fedc65a6d7e9eacbf1dbf736767126820 (diff) | |
download | NetworkManager-9c67b6fb08e4b2794ccab461f0ac9a6cffac33ee.tar.gz |
libnm-core, core: register NMConnectionError with D-Bus
Register NMConnectionError with D-Bus on both sides, so that, eg,
connection validation failures in the daemon will translate to the
correct error codes in the client.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/test-networkmanager-service.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py index d98174ce20..9be2e8541b 100755 --- a/tools/test-networkmanager-service.py +++ b/tools/test-networkmanager-service.py @@ -905,9 +905,31 @@ class NetworkManager(ExportedObj): ################################################################### IFACE_CONNECTION = 'org.freedesktop.NetworkManager.Settings.Connection' +class InvalidPropertyException(dbus.DBusException): + _dbus_error_name = IFACE_CONNECTION + '.InvalidProperty' + +class MissingPropertyException(dbus.DBusException): + _dbus_error_name = IFACE_CONNECTION + '.MissingProperty' + +class InvalidSettingException(dbus.DBusException): + _dbus_error_name = IFACE_CONNECTION + '.InvalidSetting' + +class MissingSettingException(dbus.DBusException): + _dbus_error_name = IFACE_CONNECTION + '.MissingSetting' + class Connection(dbus.service.Object): def __init__(self, bus, object_path, settings, remove_func): dbus.service.Object.__init__(self, bus, object_path) + + if not settings.has_key('connection'): + raise MissingSettingException('connection: setting is required') + s_con = settings['connection'] + if not s_con.has_key('type'): + raise MissingPropertyException('connection.type: property is required') + type = s_con['type'] + if not type in ['802-3-ethernet', '802-11-wireless', 'vlan', 'wimax']: + raise InvalidPropertyException('connection.type: unsupported connection type') + self.path = object_path self.settings = settings self.remove_func = remove_func |