From: Martin Kolman <mkolman(a)redhat.com>
Outside of the Anaconda environment, such as in Initial setup,
there might be no payload to restart. This might lead to a crash
and/or confusing error messages in logs.
Related: rhbz#1270354
---
pyanaconda/ui/gui/spokes/network.py | 11 +++++++----
pyanaconda/ui/tui/spokes/network.py | 10 ++++++----
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 052a375..893cb36 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -1497,10 +1497,13 @@ def apply(self):
log.debug("network: apply ksdata %s", self.data.network)
if self.networking_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)
+ if ANACONDA_ENVIRON in anaconda_flags.environs:
+ 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)
+ else:
+ log.debug("network spoke (apply), payload refresh skipped (running
outside of installation environment)")
self.networking_changed = False
else:
log.debug("network spoke (apply), no changes detected")
diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py
index 6d0ac65..bdd4ff0 100644
--- a/pyanaconda/ui/tui/spokes/network.py
+++ b/pyanaconda/ui/tui/spokes/network.py
@@ -21,7 +21,7 @@
#
-from pyanaconda.flags import can_touch_runtime_system
+from pyanaconda.flags import can_touch_runtime_system, flags
from pyanaconda.ui.categories.system import SystemCategory
from pyanaconda.ui.tui.spokes import EditTUISpoke, OneShotEditTUIDialog
from pyanaconda.ui.tui.spokes import EditTUISpokeEntry as Entry
@@ -33,6 +33,7 @@
from pyanaconda.regexes import IPV4_PATTERN_WITHOUT_ANCHORS,
IPV4_NETMASK_WITHOUT_ANCHORS
from pyanaconda.constants_text import INPUT_PROCESSED
+from pyanaconda.constants import ANACONDA_ENVIRON
import logging
log = logging.getLogger("anaconda")
@@ -244,9 +245,10 @@ def apply(self):
if self._apply:
self._apply = False
- from pyanaconda.packaging import payloadMgr
- payloadMgr.restartThread(self.storage, self.data, self.payload,
- self.instclass, checkmount=False)
+ if ANACONDA_ENVIRON in flags.environs:
+ 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/b0d7b3b29149ceb07fac6fa2f3...