diff options
author | Chris Lumens <clumens@redhat.com> | 2009-12-21 11:02:59 -0500 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2010-02-04 14:07:31 -0500 |
commit | d6d4c4800ebc2958eb87a706e4a7c799647ca447 (patch) | |
tree | 4dd234f33d31b4ef68007b8f8392e321f151ad17 | |
parent | 2c4932e109f2f913d5efb9f906348ffaacd6b0ee (diff) | |
download | anaconda-d6d4c4800ebc2958eb87a706e4a7c799647ca447.tar.gz anaconda-d6d4c4800ebc2958eb87a706e4a7c799647ca447.tar.xz anaconda-d6d4c4800ebc2958eb87a706e4a7c799647ca447.zip |
Move network to the Anaconda object.
-rwxr-xr-x | anaconda | 12 | ||||
-rw-r--r-- | booty/bootloaderInfo.py | 12 | ||||
-rwxr-xr-x | gui.py | 4 | ||||
-rw-r--r-- | instdata.py | 7 | ||||
-rw-r--r-- | iw/advanced_storage.py | 4 | ||||
-rw-r--r-- | iw/lvm_dialog_gui.py | 2 | ||||
-rw-r--r-- | iw/network_gui.py | 2 | ||||
-rw-r--r-- | kickstart.py | 12 | ||||
-rw-r--r-- | network.py | 2 | ||||
-rw-r--r-- | rescue.py | 4 | ||||
-rw-r--r-- | storage/__init__.py | 2 | ||||
-rw-r--r-- | text.py | 2 | ||||
-rw-r--r-- | textw/netconfig_text.py | 8 | ||||
-rw-r--r-- | textw/network_text.py | 2 | ||||
-rw-r--r-- | textw/partition_text.py | 2 | ||||
-rw-r--r-- | yuminstall.py | 2 |
16 files changed, 45 insertions, 34 deletions
@@ -452,6 +452,7 @@ class Anaconda(object): self.ksdata = None self.mediaDevice = None self.methodstr = None + self._network = None self._platform = None self.proxy = None self.proxyUsername = None @@ -529,6 +530,14 @@ class Anaconda(object): return self._intf @property + def network(self): + if not self._network: + import network + self._network = network.Network() + + return self._network + + @property def platform(self): if not self._platform: import platform @@ -617,6 +626,8 @@ class Anaconda(object): if not self.isHeadless: self.keyboard.write(self.rootPath) + self.network.write(instPath=self.rootPath, anaconda=self) + # XXX: This is temporary until instdata goes away completely. self.id.write() @@ -673,6 +684,7 @@ class Anaconda(object): if not self.isHeadless: self.keyboard.writeKS(f) + self.network.writeKS(f) # XXX: This is temporary until instdata goes away completely. self.id.writeKS(f) diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index 12ed6f66a..a4fa62f09 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -91,8 +91,14 @@ class KernelArguments: types = {} root = self.id.storage.rootDevice for d in self.id.storage.devices: - if d is not root and not root.dependsOn(d): - continue + if root.dependsOn(d): + dracutSetupString = d.dracutSetupString() + if len(dracutSetupString): + args += " %s" % dracutSetupString + import storage + if isinstance(d, storage.devices.NetworkStorageDevice): + args += " " + args += self.network.dracutSetupString(d) s = d.dracutSetupString() types[s.split("=")[0]] = True @@ -100,7 +106,7 @@ class KernelArguments: import storage if isinstance(d, storage.devices.NetworkStorageDevice): - args.append(self.id.network.dracutSetupString(d)) + args.append(self.anaconda.network.dracutSetupString(d)) for i in [ [ "rd_LUKS_UUID", "rd_NO_LUKS" ], [ "rd_LVM_LV", "rd_NO_LVM" ], @@ -1003,10 +1003,10 @@ class InstallInterface: pass def enableNetwork(self): - if len(self.anaconda.id.network.netdevices) == 0: + if len(self.anaconda.network.netdevices) == 0: return False from netconfig_dialog import NetworkConfigurator - net = NetworkConfigurator(self.anaconda.id.network) + net = NetworkConfigurator(self.anaconda.network) ret = net.run() net.destroy() diff --git a/instdata.py b/instdata.py index fba1aa469..6fb7f0326 100644 --- a/instdata.py +++ b/instdata.py @@ -24,7 +24,6 @@ import os, sys import stat import string -import network import firewall import security import timezone @@ -55,7 +54,6 @@ class InstallData: # # - The install language - self.network = network.Network() self.firewall = firewall.Firewall() self.security = security.Security() self.timezone = timezone.Timezone() @@ -98,8 +96,6 @@ class InstallData: except RuntimeError, msg: log.error("Error running %s: %s", args, msg) - self.network.write (instPath=self.anaconda.rootPath, - anaconda=self.anaconda) self.firewall.write (self.anaconda.rootPath) self.security.write (self.anaconda.rootPath) self.desktop.write(self.anaconda.rootPath) @@ -138,9 +134,6 @@ class InstallData: log.error("User %s already exists, not creating." % ud.name) def writeKS(self, f): - if not self.anaconda.isHeadless: - self.network.writeKS(f) - if self.rootPassword["isCrypted"]: args = " --iscrypted %s" % self.rootPassword["password"] else: diff --git a/iw/advanced_storage.py b/iw/advanced_storage.py index f7d5a0777..c6fbf5f3b 100644 --- a/iw/advanced_storage.py +++ b/iw/advanced_storage.py @@ -43,7 +43,7 @@ def addFcoeDrive(anaconda): store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) combo.set_model(store) - netdevs = anaconda.id.network.available() + netdevs = anaconda.network.available() keys = netdevs.keys() keys.sort() selected_interface = None @@ -107,7 +107,7 @@ def addFcoeDrive(anaconda): def addIscsiDrive(anaconda): if not network.hasActiveNetDev(): - net = NetworkConfigurator(anaconda.id.network) + net = NetworkConfigurator(anaconda.network) ret = net.run() net.destroy() if ret != gtk.RESPONSE_OK: diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py index 44cd840cb..823a83629 100644 --- a/iw/lvm_dialog_gui.py +++ b/iw/lvm_dialog_gui.py @@ -1246,7 +1246,7 @@ class VolumeGroupEditor: if not self.isNew: self.volnameEntry.set_text(self.vg.name) else: - self.volnameEntry.set_text(self.storage.createSuggestedVGName(anaconda.id.network)) + self.volnameEntry.set_text(self.storage.createSuggestedVGName(anaconda.network)) else: lbl = createAlignedLabel(_("Volume Group Name:")) self.volnameEntry = gtk.Label(self.vg.name) diff --git a/iw/network_gui.py b/iw/network_gui.py index c3086d563..e6c223d42 100644 --- a/iw/network_gui.py +++ b/iw/network_gui.py @@ -79,5 +79,5 @@ class NetworkWindow(InstallWindow): custom_icon="error") self.hostnameError() - self.anaconda.id.network.hostname = hostname + self.anaconda.network.hostname = hostname return None diff --git a/kickstart.py b/kickstart.py index 05100fa75..90047ed41 100644 --- a/kickstart.py +++ b/kickstart.py @@ -527,7 +527,7 @@ class Logging(commands.logging.FC6_Logging): class NetworkData(commands.network.F8_NetworkData): def execute(self, anaconda): if self.bootProto: - devices = anaconda.id.network.netdevices + devices = anaconda.network.netdevices if (devices and self.bootProto): if not self.device: list = devices.keys () @@ -565,14 +565,14 @@ class NetworkData(commands.network.F8_NetworkData): dev.set(("wepkey", self.wepkey)) if self.hostname != "": - anaconda.id.network.setHostname(self.hostname) - anaconda.id.network.overrideDHCPhostname = True + anaconda.network.setHostname(self.hostname) + anaconda.network.overrideDHCPhostname = True if self.nameserver != "": - anaconda.id.network.setDNS(self.nameserver, device) + anaconda.network.setDNS(self.nameserver, device) if self.gateway != "": - anaconda.id.network.setGateway(self.gateway, device) + anaconda.network.setGateway(self.gateway, device) needs_net = (anaconda.methodstr and (anaconda.methodstr.startswith("http:") or @@ -580,7 +580,7 @@ class NetworkData(commands.network.F8_NetworkData): anaconda.methodstr.startswith("nfs:"))) if needs_net and not network.hasActiveNetDev(): log.info("Bringing up network in stage2 kickstart ...") - rc = anaconda.id.network.bringUp() + rc = anaconda.network.bringUp() log.info("Network setup %s" % (rc and 'succeeded' or 'failed',)) class MultiPath(commands.multipath.FC6_MultiPath): diff --git a/network.py b/network.py index 2fabff1d9..6d3f07d8d 100644 --- a/network.py +++ b/network.py @@ -111,7 +111,7 @@ def getDefaultHostname(anaconda): return hn try: - hn = anaconda.id.network.hostname + hn = anaconda.network.hostname except: hn = None @@ -89,7 +89,7 @@ class RescueInterface: return OkCancelWindow(self.screen, title, text) def enableNetwork(self, anaconda): - if len(anaconda.id.network.netdevices) == 0: + if len(anaconda.network.netdevices) == 0: return False from netconfig_text import NetworkConfiguratorText w = NetworkConfiguratorText(self.screen, anaconda) @@ -242,7 +242,7 @@ def runRescue(anaconda): "will not be available in rescue mode.")) break - startNetworking(anaconda.id.network, anaconda.intf) + startNetworking(anaconda.network, anaconda.intf) break else: break diff --git a/storage/__init__.py b/storage/__init__.py index a7dc24513..14ab49d7f 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -735,7 +735,7 @@ class Storage(object): if kwargs.has_key("name"): name = kwargs.pop("name") else: - name = self.createSuggestedVGName(self.anaconda.id.network) + name = self.createSuggestedVGName(self.anaconda.network) if name in [d.name for d in self.devices]: raise ValueError("name already in use") @@ -379,7 +379,7 @@ class InstallInterface: return (passphrase, isglobal) def enableNetwork(self): - if len(self.anaconda.id.network.netdevices) == 0: + if len(self.anaconda.network.netdevices) == 0: return False from netconfig_text import NetworkConfiguratorText w = NetworkConfiguratorText(self.screen, self.anaconda) diff --git a/textw/netconfig_text.py b/textw/netconfig_text.py index 986db2dd6..4cea19204 100644 --- a/textw/netconfig_text.py +++ b/textw/netconfig_text.py @@ -96,10 +96,10 @@ class NetworkConfiguratorText: self.interfaceList = CheckboxTree(height=3, scroll=1) - netdevs = self.anaconda.id.network.available() + netdevs = self.anaconda.network.available() devs = netdevs.keys() devs.sort() - ksdevice = self.anaconda.id.network.getKSDevice() + ksdevice = self.anaconda.network.getKSDevice() if ksdevice: ksdevice = ksdevice.get('DEVICE') selected_interface = None @@ -178,7 +178,7 @@ class NetworkConfiguratorText: #self._ipv6Toggled() self._dhcpToggled() - netdevs = self.anaconda.id.network.available() + netdevs = self.anaconda.network.available() while True: result = grid.run() @@ -274,7 +274,7 @@ class NetworkConfiguratorText: continue w = self.anaconda.intf.waitWindow(_("Configuring Network Interfaces"), _("Waiting for NetworkManager")) - result = self.anaconda.id.network.bringUp(devices=selected_netdevs) + result = self.anaconda.network.bringUp(devices=selected_netdevs) w.pop() if result: break diff --git a/textw/network_text.py b/textw/network_text.py index f5f8eac1a..26499b8cc 100644 --- a/textw/network_text.py +++ b/textw/network_text.py @@ -27,7 +27,7 @@ import network class HostnameWindow: def __call__(self, screen, anaconda): hname = network.getDefaultHostname(anaconda) - anaconda.id.network.hostname = hname + anaconda.network.hostname = hname return INSTALL_OK # vim:tw=78:ts=4:et:sw=4 diff --git a/textw/partition_text.py b/textw/partition_text.py index a299b94e0..e5db580f1 100644 --- a/textw/partition_text.py +++ b/textw/partition_text.py @@ -219,7 +219,7 @@ class PartitionTypeWindow: return INSTALL_OK def addFcoeDriveDialog(self, screen): - netdevs = self.anaconda.id.network.available() + netdevs = self.anaconda.network.available() devs = netdevs.keys() devs.sort() diff --git a/yuminstall.py b/yuminstall.py index 53d6070aa..e34fa03ce 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1582,7 +1582,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon if os.access("/etc/modprobe.d/anaconda.conf", os.R_OK): shutil.copyfile("/etc/modprobe.d/anaconda.conf", anaconda.rootPath + "/etc/modprobe.d/anaconda.conf") - anaconda.id.network.write(instPath=anaconda.rootPath, anaconda=anaconda) + anaconda.network.write(instPath=anaconda.rootPath, anaconda=anaconda) anaconda.id.storage.write(anaconda.rootPath) if not anaconda.isHeadless: anaconda.keyboard.write(anaconda.rootPath) |