[master 1/1] Fix only one address is shown in anaconda (#1264400)
by dashea
From: Jiri Konecny <jkonecny(a)redhat.com>
Only NMIP[4,6]Config object was connected to signal on change. But when
inner objects (Addresses, Nameservers, Gateway) changed it doesn't
notify us about this change.
Fix by connecting this inner properties too.
Resolves: rhbz#1264400
Reported-by: Marek Hruscak <mhruscak(a)redhat.com>
(cherry picked from commit b9323749c470ca3ef24bfee82f911a7b85d8f7fe)
---
pyanaconda/ui/gui/spokes/network.py | 40 +++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 829ef4d..3cbd3b7 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -67,6 +67,9 @@
AGENT_MANAGER_IFACE = 'org.freedesktop.NetworkManager.AgentManager'
AGENT_MANAGER_PATH = "/org/freedesktop/NetworkManager/AgentManager"
+IPV4_CONFIG = "IPv4"
+IPV6_CONFIG = "IPv6"
+
DEVICES_COLUMN_TITLE = 2
DEVICES_COLUMN_OBJECT = 3
@@ -747,10 +750,27 @@ def add_device_to_list(self, device):
else:
self.add_dev_cfg(DeviceConfiguration(device=device, con=con))
- device.connect("notify::ip4-config", self.on_device_config_changed)
- device.connect("notify::ip6-config", self.on_device_config_changed)
+ device.connect("notify::ip4-config", self.on_ip_obj_changed, IPV4_CONFIG)
+ device.connect("notify::ip6-config", self.on_ip_obj_changed, IPV6_CONFIG)
device.connect("state-changed", self.on_device_state_changed)
+ def on_ip_obj_changed(self, device, *args):
+ log.debug("%s object changed", args[1])
+ self.on_device_config_changed(device)
+ if args[1] == IPV4_CONFIG:
+ config = device.props.ip4_config
+ else:
+ config = device.props.ip6_config
+
+ if config:
+ # register callback when inner NMIP[4,6]Config object changed
+ config.connect("notify::addresses", self.on_config_changed, device)
+ config.connect("notify::gateway", self.on_config_changed, device)
+ config.connect("notify::nameservers", self.on_config_changed, device)
+
+ def on_config_changed(self, config, *args):
+ self.on_device_config_changed(args[1])
+
def _dev_icon_name(self, dev_cfg):
icon_name = ""
if dev_cfg.get_device_type() in self.wired_ui_device_types:
@@ -1172,6 +1192,22 @@ def disconnect_client_callbacks(self):
for device in self.client.get_devices():
_try_disconnect(device, self.on_device_config_changed)
_try_disconnect(device, self.on_device_state_changed)
+ _try_disconnect(device, self.on_ip_obj_changed)
+ for config in self._get_ip_configs(device):
+ _try_disconnect(config, self.on_config_changed)
+
+ def _get_ip_configs(self, device):
+ out = []
+ try:
+ out.append(self.props.ip4_config)
+ except AttributeError:
+ pass
+ try:
+ out.append(self.props.ip6_config)
+ except AttributeError:
+ pass
+
+ return out
def _try_disconnect(obj, callback):
try:
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/354d55698b2ec5c84d2c42bd37...
8 years, 2 months