From: Pat Riehecky <riehecky(a)fnal.gov>
When altering the network state, it may result in selected
network sources becoming inaccessable due to typos in DNS
or GATEWAY.
With this patch, after the network spoke completes with
changes to the network config, it triggers the software
payload to revalidate its state.
If the state becomes invalid, the source spoke errors will guide
the user towards what is wrong.
Resolves: rhbz#1270354
---
pyanaconda/ui/gui/spokes/network.py | 14 ++++++++++++++
pyanaconda/ui/tui/spokes/network.py | 8 ++++++++
2 files changed, 22 insertions(+)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index a45b095..d7bbb4f 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -313,6 +313,7 @@ def __init__(self, builder, spoke=None):
self.builder = builder
self._running_nmce = None
self.spoke = spoke
+ self.settings_changed = False
# button for creating of virtual bond and vlan devices
self.builder.get_object("add_toolbutton").set_sensitive(True)
@@ -597,6 +598,7 @@ def on_nmce_exited(self, pid, condition, activate=None):
uuid, devname, activate_condition = activate # pylint:
disable=unpacking-non-sequence
if activate_condition():
gtk_call_once(self._activate_connection_cb, uuid, devname)
+ self.settings_changed = True
network.logIfcfgFiles("nm-c-e run")
def _activate_connection_cb(self, uuid, devname):
@@ -617,6 +619,7 @@ def on_device_off_toggled(self, switch, *args):
if not dev_cfg:
return
+ self.settings_changed = True
log.info("network: device %s switched %s", dev_cfg.get_iface(),
"on" if active else "off")
if dev_cfg.device_type == NetworkManager.DeviceType.WIFI:
@@ -766,6 +769,7 @@ def dev_cfg(self, uuid=None, device=None):
def remove_device(self, device):
# This should not concern wifi and ethernet devices,
# just virtual devices e.g. vpn probably
+ self.settings_changed = True
log.debug("network: GUI, device removed: %s" , device.get_iface())
dev_cfg = self.dev_cfg(device=device)
if dev_cfg:
@@ -1411,6 +1415,16 @@ def __init__(self, *args, **kwargs):
def apply(self):
_update_network_data(self.data, self.network_control_box)
log.debug("network: apply ksdata %s", self.data.network)
+
+ if self.network_control_box.settings_changed:
+ log.debug("network spoke (apply) refresh payload")
+ from pyanaconda.packaging import payloadMgr
+ payloadMgr.restartThread(self.storage, self.data, self.payload,
self.instclass,
+ fallback=not anaconda_flags.automatedInstall)
+ self.network_control_box.settings_changed = False
+ else:
+ log.debug("network spoke (apply), no changes detected")
+
self.network_control_box.kill_nmce(msg="leaving network spoke")
def execute(self):
diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py
index e9b06b4..0485f28 100644
--- a/pyanaconda/ui/tui/spokes/network.py
+++ b/pyanaconda/ui/tui/spokes/network.py
@@ -52,6 +52,7 @@ def __init__(self, app, data, storage, payload, instclass):
self.hostname_dialog.value = self.data.network.hostname
self.supported_devices = []
self.errors = []
+ self._apply = False
def initialize(self):
self._load_new_devices()
@@ -214,6 +215,7 @@ def input(self, args, key):
network.update_settings_with_ksdata(devname, ndata)
if ndata._apply:
+ self._apply = True
uuid = nm.nm_device_setting_value(devname, "connection",
"uuid")
try:
nm.nm_activate_device_connection(devname, uuid)
@@ -229,6 +231,12 @@ def apply(self):
" Apply all of our settings."""
self._update_network_data()
+ if self._apply:
+ self._apply = False
+ from pyanaconda.packaging import payloadMgr
+ payloadMgr.restartThread(self.storage, self.data, self.payload,
+ self.instclass, checkmount=False)
+
def _update_network_data(self):
hostname = self.data.network.hostname
--
To view this commit on github, visit
https://github.com/rhinstaller/anaconda/commit/c89da2ccc34d557774e923e248...