[PATCH 13/15] remove Network(): disabling of ipv6
Radek Vykydal
rvykydal at redhat.com
Thu Jul 19 10:02:46 UTC 2012
---
pyanaconda/__init__.py | 1 +
pyanaconda/network.py | 31 +++++++++++++++++++------------
pyanaconda/yuminstall.py | 1 +
3 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py
index db835c4..4763def 100644
--- a/pyanaconda/__init__.py
+++ b/pyanaconda/__init__.py
@@ -288,6 +288,7 @@ class Anaconda(object):
if not self.ksdata:
self.instClass.setNetworkOnbootDefault(self.network)
self.network.write()
+ network.disableIPV6()
network.copyConfigToPath(ROOT_PATH)
network.disableNMForStorageDevices(self.storage)
network.autostartFCoEDevices(self.storage)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index ef15463..b26240f 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -490,18 +490,6 @@ class Network:
# /etc/resolv.conf is managed by NM
- # disable ipv6
- if ('noipv6' in flags.cmdline
- and not any(dev.get('IPV6INIT') == "yes" for dev in devices)):
- if os.path.exists(ipv6ConfFile):
- log.warning('Not disabling ipv6, %s exists' % ipv6ConfFile)
- else:
- log.info('Disabling ipv6 on target system')
- f = open(ipv6ConfFile, "w")
- f.write("# Anaconda disabling ipv6\n")
- f.write("options ipv6 disable=1\n")
- f.close()
-
# write out current configuration state and wait for NetworkManager
# to bring the device up, watch NM state and return to the caller
# once we have a state
@@ -886,6 +874,25 @@ def get_ksdevice_name(ksspec=""):
return ksdevice
+# note that NetworkDevice.get returns "" if key is not found
+def get_ifcfg_value(iface, key, root_path=""):
+ dev = NetworkDevice(os.path.normpath(root_path + netscriptsDir), iface)
+ dev.loadIfcfgFile()
+ return dev.get(key)
+
+# TODO: do it right in sysroot (instead of copying the files later)?
+def disableIPV6():
+ if ('noipv6' in flags.cmdline
+ and not any(get_ifcfg_value(dev, 'IPV6INIT') == "yes"
+ for dev in getDevices())):
+ if os.path.exists(ipv6ConfFile):
+ log.warning('Not disabling ipv6, %s exists' % ipv6ConfFile)
+ else:
+ log.info('Disabling ipv6 on target system')
+ f = open(ipv6ConfFile, "w")
+ f.write("# Anaconda disabling ipv6\n")
+ f.write("options ipv6 disable=1\n")
+ f.close()
def disableNMForStorageDevices(storage):
for devname in getDevices():
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index b47f4de..a80bcbb 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -1626,6 +1626,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
if not anaconda.ksdata:
anaconda.instClass.setNetworkOnbootDefault(anaconda.network)
anaconda.network.write()
+ network.disableIPV6()
network.copyConfigToPath(ROOT_PATH)
anaconda.storage.write()
else:
--
1.7.4
More information about the anaconda-patches
mailing list