Do networking initialization in NetworkStandaloneSpoke.__init__. Not completely sure if it is the right place (maybe pre-GUI would be better)
The initialization consists of: - ksdata.network.hostnmae object update (only hostname atm) for storage, and perhaps for hostname GUI when we have it - creating missing ifcfg files which may go to dracut (pending patch), for now it should fix network spoke traceback from summit demo --- pyanaconda/network.py | 40 ++++++++++++++++------------------ pyanaconda/ui/gui/spokes/network.py | 8 +----- 2 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py index ac9bd00..2e269df 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -400,27 +400,12 @@ class WirelessNetworkDevice(NetworkDevice): def write(self): pass
- -class Network: - - def __init__(self): - - ifcfglog.debug("Network object created called") - - # TODO this may need to be handled in getDevices() - if flags.imageInstall: - return - - # TODO this should go away (patch pending), - # default ifcfg files should be created in dracut - - # populate self.netdevices - devhash = isys.getDeviceProperties(dev=None) - for iface in devhash.keys(): - if not isys.isWirelessDevice(iface): - device = NetworkDevice(netscriptsDir, iface) - if not os.access(device.path, os.R_OK): - device.setDefaultConfig() +def createMissingDefaultIfcfgs(): + for iface in getDevices(): + if not isys.isWirelessDevice(iface): + device = NetworkDevice(netscriptsDir, iface) + if not os.access(device.path, os.R_OK): + device.setDefaultConfig()
def getDevices(): # TODO: filter with existence of ifcfg file? @@ -871,3 +856,16 @@ def writeNetworkConf(storage, ksdata, instClass): instClass.setNetworkOnbootDefault() disableNMForStorageDevices(storage) autostartFCoEDevices(storage) + +# networking initialization and ksdata object update +def init_networking(ksdata): + from pyanaconda.kickstart import NetworkData + + if not flags.imageInstall: + # XXX: this should go to anaconda dracut + createMissingDefaultIfcfgs() + + if ksdata.network.hostname is None: + hostname = getHostname() + nd = NetworkData(hostname=hostname) + ksdata.network.network.append(nd) diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index b19c223..69a9a36 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -39,8 +39,7 @@ from pyanaconda.ui.gui.spokes import NormalSpoke, StandaloneSpoke from pyanaconda.ui.gui.categories.software import SoftwareCategory from pyanaconda.ui.gui.hubs.summary import SummaryHub
-from pyanaconda.network import NetworkDevice, netscriptsDir, kickstartNetworkData, getActiveNetDevs, getHostname -from pyanaconda.kickstart import NetworkData +from pyanaconda.network import NetworkDevice, netscriptsDir, kickstartNetworkData, getActiveNetDevs, init_networking
from gi.repository import GLib, GObject, Pango, Gio, NetworkManager, NMClient import dbus @@ -971,10 +970,7 @@ class NetworkStandaloneSpoke(StandaloneSpoke): def __init__(self, *args, **kwargs): StandaloneSpoke.__init__(self, *args, **kwargs)
- if self.data.network.hostname is None: - hostname = getHostname() - nd = NetworkData(hostname=hostname) - self.data.network.network.append(nd) + init_networking(self.data)
self.network_control_box = NetworkControlBox(self.builder) parent = self.builder.get_object("AnacondaStandaloneWindow-action_area5")