diff options
author | Will Woods <wwoods@redhat.com> | 2012-03-30 12:52:48 -0400 |
---|---|---|
committer | Will Woods <wwoods@redhat.com> | 2012-03-30 12:52:48 -0400 |
commit | f7f8901151ee9e75d148495b30e7d93c81e8b6ef (patch) | |
tree | f99b5589aa712d0ad38cdb704e6e3ba6aaee50fc /pyanaconda/network.py | |
parent | f0cc6544da56fe1477b1cabb0e619e7ca2a98312 (diff) | |
parent | 6d0a4a2b246b41c8f4b1de4c6d174995cb94dd6e (diff) | |
download | anaconda-f7f8901151ee9e75d148495b30e7d93c81e8b6ef.tar.gz anaconda-f7f8901151ee9e75d148495b30e7d93c81e8b6ef.tar.xz anaconda-f7f8901151ee9e75d148495b30e7d93c81e8b6ef.zip |
Merge 'f17-branch'
This brings in the 'noloader' changes from f17-branch.
The changelogs have been dropped from the specfile, but that
was somewhat intentional.
Conflicts:
anaconda
anaconda.spec.in
configure.ac
data/linuxrc.s390
data/systemd/Makefile.am
data/systemd/anaconda.service
data/systemd/anaconda.target
data/systemd/anaconda@.service
data/systemd/loader.service
dracut/Makefile.am
dracut/anaconda-lib.sh
dracut/anaconda-netroot.sh
dracut/kickstart-genrules.sh
dracut/module-setup.sh
dracut/parse-anaconda-kickstart.sh
dracut/parse-anaconda-options.sh
dracut/parse-anaconda-repo.sh
dracut/parse-kickstart
dracut/repo-genrules.sh
po/anaconda.pot
Diffstat (limited to 'pyanaconda/network.py')
-rw-r--r-- | pyanaconda/network.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/pyanaconda/network.py b/pyanaconda/network.py index c3ca0446d..cf7085a80 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -242,6 +242,28 @@ class NetworkDevice(IfcfgFile): return s + # anaconda doesn't actually need this configuration, but if we don't write + # it to the installed system then 'ifup' doesn't work after install. + # FIXME: make 'ifup' use its own defaults! + def setDefaultConfig(self): + ifcfglog.debug("NetworkDevice %s: setDefaultConfig()" % self.iface) + self.set(("DEVICE", self.iface), + ("BOOTPROTO", "dhcp"), + ("ONBOOT", "no")) # for "security", or something + + try: + mac = open("/sys/class/net/%s/address" % self.iface).read().strip() + self.set(("HWADDR", mac.upper())) + except IOError as e: + ifcfglog.warning("HWADDR: %s" % str(e)) + + try: + uuid = open("/proc/sys/kernel/random/uuid").read().strip() + self.set(("UUID", uuid)) + except IOError as e: + ifcfglog.warning("UUID: %s" % str(e)) + + self.writeIfcfgFile() def loadIfcfgFile(self): ifcfglog.debug("%s:\n%s" % (self.path, self.fileContent())) @@ -311,6 +333,8 @@ class NetworkDevice(IfcfgFile): shutil.move(newifcfg, keyfile) def fileContent(self): + if not os.path.exists(self.path): + return "" f = open(self.path, 'r') content = f.read() f.close() @@ -418,9 +442,7 @@ class Network: if os.access(device.path, os.R_OK): device.loadIfcfgFile() else: - log.info("Network.update(): %s file not found" % - device.path) - continue + device.setDefaultConfig() # TODORV - the last iface in loop wins, might be ok, # not worthy of special juggling |