[PATCH 4/8] Network: fix disabling of ipv6 (noipv6 option)
Radek Vykydal
rvykydal at redhat.com
Tue Jan 29 14:30:01 UTC 2013
On 01/29/2013 02:50 PM, Vratislav Podzimek wrote:
> On Tue, 2013-01-29 at 13:10 +0100, Radek Vykydal wrote:
>> ---
>> pyanaconda/network.py | 16 +++++++---------
>> 1 file changed, 7 insertions(+), 9 deletions(-)
>>
>> diff --git a/pyanaconda/network.py b/pyanaconda/network.py
>> index 3c5779f..3c9ef43 100644
>> --- a/pyanaconda/network.py
>> +++ b/pyanaconda/network.py
>> @@ -52,7 +52,7 @@ sysconfigDir = "/etc/sysconfig"
>> netscriptsDir = "%s/network-scripts" % (sysconfigDir)
>> networkConfFile = "%s/network" % (sysconfigDir)
>> hostnameFile = "/etc/hostname"
>> -ipv6ConfFile = "/etc/modprobe.d/ipv6.conf"
>> +ipv6ConfFile = "/etc/sysctl.d/anaconda.conf"
>> ifcfgLogFile = "/tmp/ifcfg.log"
>> CONNECTION_TIMEOUT = 45
>> DEFAULT_HOSTNAME = "localhost.localdomain"
>> @@ -840,14 +840,12 @@ def disableIPV6(rootpath):
>> if ('noipv6' in flags.cmdline
>> and not any(get_ifcfg_value(dev, 'IPV6INIT') == "yes"
>> for dev in getDevices())):
>> - if os.path.exists(cfgfile):
>> - log.warning('Not disabling ipv6, %s exists' % cfgfile)
>> - else:
>> - log.info('Disabling ipv6 on target system')
>> - f = open(cfgfile, "w")
>> - f.write("# Anaconda disabling ipv6\n")
>> - f.write("options ipv6 disable=1\n")
>> - f.close()
>> + log.info('Disabling ipv6 on target system')
>> + f = open(cfgfile, "a")
>> + f.write("# Anaconda disabling ipv6 (noipv6 option)\n")
>> + f.write("net.ipv6.conf.all.disable_ipv6=1\n")
>> + f.write("net.ipv6.conf.default.disable_ipv6=1\n")
>> + f.close()
> with open(cfgfile, "a") as f:
> ...
>
> would be better. And should it really be opened for appending?
>
Alright, I'll go with with.
As for the append mode, I am using it because I chose
/etc/sysctl/anaconda.conf
(anaconda's proper sysctl config file) thinking that another parts of
anaconda
may want to modify some configuration here too in the future.
More information about the anaconda-patches
mailing list