<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Sending v2 of the patch addressing your
points and adding replacement<br>
of one more (the last) occurrence of list_connections() method<br>
call.<br>
<br>
On 10/15/2013 02:12 AM, Brian C. Lane wrote:<br>
</div>
<blockquote cite="mid:20131015001203.GH1882@lister.brianlane.com"
type="cite">
<pre wrap="">On Mon, Oct 14, 2013 at 05:00:08PM +0200, Radek Vykydal wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Another step in moving to GDBus.
libnm-glib (NMRemoteSettings.list_connections()) returns empty list
when called for the first time.
---
pyanaconda/installclasses/fedora.py | 2 +-
pyanaconda/network.py | 6 +-
pyanaconda/nm.py | 47 ++++++++++++--
pyanaconda/ui/gui/spokes/network.py | 118 +++++++++++++-----------------------
4 files changed, 86 insertions(+), 87 deletions(-)
</pre>
</blockquote>
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">+def nm_ap_setting_value(ssid, key1, key2):
+ """Return value of ap's setting specified by key1 and key2.
+
+ :param name: name of ap (ssid)
+ :type name: str
</pre>
</blockquote>
<pre wrap="">
Looks like you changed it to ssid, not name.
</pre>
<blockquote type="cite">
<pre wrap="">+ :param key1: first-level key of setting (eg "connection")
+ :type key1: str
+ :param key2: second-level key of setting (eg "uuid")
+ :type key2: str
+ :return: value of setting or None if the setting was not found
+ which means it does not exist or default value is used
+ by NM
+ :rtype: unpacked GDBus variant or None
+ :raise SettingsNotFoundError: if settings were not found
+ (eg for "wlan0")
+ """
+ settings_path = _settings_for_ap(ssid)
+ if not settings_path:
+ raise SettingsNotFoundError(ssid)
+ proxy = _get_proxy(object_path=settings_path, interface_name="org.freedesktop.NetworkManager.Settings.Connection")
+ args = None
+ settings = proxy.call_sync("GetSettings",
+ args,
+ Gio.DBusCallFlags.NONE,
+ DEFAULT_DBUS_TIMEOUT,
+ None)
+ settings = settings.unpack()[0]
+ try:
+ value = settings[key1][key2]
+ except KeyError:
+ #raise SettingNotFoundError(key1, key2)
+ value = None
</pre>
</blockquote>
<pre wrap="">
It isn't actually raising it :)
</pre>
<blockquote type="cite">
<pre wrap="">+ return value
+
+
def nm_activate_device_connection(dev_name, con_uuid):
"""Activate device with specified connection.
</pre>
</blockquote>
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">@@ -958,7 +993,7 @@ def test():
if wireless_device:
try:
nm_update_settings_of_device(wireless_device, [[key1, key2, new_value, None]])
- except DeviceSettingsNotFoundError as e:
+ except SettingsNotFoundError as e:
print "%s" % e
</pre>
</blockquote>
<pre wrap="">
Not new, but we shouldn't be printing anything.
</pre>
<blockquote type="cite">
<pre wrap=""> class CellRendererSignal(Gtk.CellRendererPixbuf):
@@ -386,11 +381,14 @@ class NetworkControlBox(object):
log.info("network: access point changed: %s", ssid_target)
- con = self.find_connection_for_device(device, ssid_target)
- if con:
- self.client.activate_connection(con, device,
- None, None, None)
- else:
+ try:
+ uuid = nm.nm_ap_setting_value(ssid_target, "connection", "uuid")
+ try:
+ nm.nm_activate_device_connection(device.get_iface(), uuid)
+ except nm.UnmanagedDeviceError as e:
+ log.debug("network: on_wireless_ap_changed: %s", e)
+ except nm.SettingsNotFoundError as e:
+ log.debug("network: on_wireless_ap_changed: %s", e)
self.client.add_and_activate_connection(None, device, ap_obj_path,
None, None)
</pre>
</blockquote>
<pre wrap="">
I don't think you need 2 levels of try here, just have separate except
clauses since the errors are different.
Other than those it looks ok.
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
anaconda-patches mailing list
<a class="moz-txt-link-abbreviated" href="mailto:anaconda-patches@lists.fedorahosted.org">anaconda-patches@lists.fedorahosted.org</a>
<a class="moz-txt-link-freetext" href="https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches">https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches</a>
</pre>
</blockquote>
<br>
</body>
</html>