[master 3/20] libnm in spoke: showing ip configuration of a device
rvykydal
installerbot-noreply at redhat.com
Mon Aug 31 14:55:46 UTC 2015
From: Radek Vykydal <rvykydal at redhat.com>
---
pyanaconda/ui/gui/spokes/network.py | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index de1eba8..8344dee 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -804,18 +804,17 @@ def _refresh_device_cfg(self, dev_cfg):
dt = "wireless"
if dev_cfg.device:
- try:
- ipv4cfg = nm.nm_device_ip_config(dev_cfg.device.get_iface(), version=4)
- ipv6cfg = nm.nm_device_ip_config(dev_cfg.device.get_iface(), version=6)
- except (nm.UnknownDeviceError, nm.UnknownMethodGetError):
- ipv4cfg = ipv6cfg = None
+ ipv4cfg = dev_cfg.device.get_ip4_config()
+ ipv6cfg = dev_cfg.device.get_ip6_config()
else:
ipv4cfg = ipv6cfg = None
- if ipv4cfg and ipv4cfg[0]:
- addr_str, prefix, gateway_str = ipv4cfg[0][0]
- netmask_str = network.prefix2netmask(prefix)
- dnss_str = " ".join(ipv4cfg[1])
+ if ipv4cfg:
+ addr_str = ",".join("%s/%d" % (a.get_address(), a.get_prefix())
+ for a in ipv4cfg.get_addresses())
+ netmask_str = None
+ gateway_str = ipv4cfg.get_gateway()
+ dnss_str = ",".join(ipv4cfg.get_nameservers())
else:
addr_str = dnss_str = gateway_str = netmask_str = None
self._set_device_info_value(dt, "ipv4", addr_str)
@@ -825,13 +824,11 @@ def _refresh_device_cfg(self, dev_cfg):
self._set_device_info_value(dt, "subnet", netmask_str)
addr6_str = ""
- if ipv6cfg and ipv6cfg[0]:
- for ipv6addr in ipv6cfg[0]:
- addr_str, prefix, gateway_str = ipv6addr
- # Do not display link-local addresses
- if not addr_str.startswith("fe80:"):
- addr6_str += "%s/%d\n" % (addr_str, prefix)
-
+ if ipv6cfg:
+ addr6_str = ",".join("%s/%d" % (a.get_address(), a.get_prefix())
+ for a in ipv6cfg.get_addresses()
+ # Do not display link-local addresses
+ if not a.get_address().startswith("fe80:"))
self._set_device_info_value(dt, "ipv6", addr6_str.strip() or None)
if ipv4cfg and addr6_str:
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/8740234a925832edf649619b805d1dc517251146
More information about the anaconda-patches
mailing list