[master 17/20] libnm in spoke: use libmn objects instead of names an uuids (device on/off)
rvykydal
installerbot-noreply at redhat.com
Mon Aug 31 14:56:00 UTC 2015
From: Radek Vykydal <rvykydal at redhat.com>
---
pyanaconda/ui/gui/spokes/network.py | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index a308ff0..c761425 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -599,6 +599,8 @@ def on_device_off_toggled(self, switch, *args):
dev_cfg = self.selected_dev_cfg()
if not dev_cfg:
return
+ device = dev_cfg.device
+ con = dev_cfg.con
log.info("network: device %s switched %s", dev_cfg.get_iface(), "on" if active else "off")
@@ -606,20 +608,17 @@ def on_device_off_toggled(self, switch, *args):
self.client.wireless_set_enabled(active)
else:
if active:
- dev_name = dev_cfg.device and dev_cfg.device.get_iface()
- if not dev_cfg.con:
+ if not con:
log.debug("network: on_device_off_toggled: no connection for %s",
- dev_name)
+ dev_cfg.get_iface())
return
- try:
- nm.nm_activate_device_connection(dev_name, dev_cfg.get_uuid())
- except (nm.UnmanagedDeviceError, nm.UnknownDeviceError, nm.UnknownConnectionError) as e:
- log.debug("network: on_device_off_toggled: %s", e)
+
+ self.client.activate_connection_async(con, device, None, None, self.added_con_cb)
else:
- try:
- nm.nm_disconnect_device(dev_cfg.get_iface())
- except (nm.UnmanagedDeviceError, nm.DeviceNotActiveError) as e:
- log.debug("network: on_device_off_toggled: %s", e)
+ if not device:
+ log.debug("network: on_device_off_toggled: no device for %s", dev_cfg.get_iface())
+ return
+ device.disconnect(None)
def on_add_device_clicked(self, *args):
dialog = self.builder.get_object("add_device_dialog")
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/1ca28a208ac1b21b9f2f2f020719c8eb1495efbb
More information about the anaconda-patches
mailing list