@@ -1546,18 +1546,17 @@ def configureNetworking(mounts, admin_iface, admin_bridge, admin_config, hn_conf
15461546 # now we need to write /etc/sysconfig/network
15471547 nfd = open ("%s/etc/sysconfig/network" % mounts ["root" ], "w" )
15481548 nfd .write ("NETWORKING=yes\n " )
1549- ipv6_conf = open ("%s/etc/sysctl.d/91-net-ipv6.conf" % mounts ["root" ], "w" )
1550- if admin_config .modev6 :
1551- nfd .write ("NETWORKING_IPV6=yes\n " )
1552- util .runCmd2 (['chroot' , mounts ['root' ], 'systemctl' , 'enable' , 'ip6tables' ])
1553- for i in ['all' , 'default' ]:
1554- ipv6_conf .write ('net.ipv6.conf.%s.disable_ipv6=0\n ' % i )
1555- else :
1556- nfd .write ("NETWORKING_IPV6=no\n " )
1557- for i in ['all' , 'default' ]:
1558- ipv6_conf .write ('net.ipv6.conf.%s.disable_ipv6=1\n ' % i )
1559- netutil .disable_ipv6_module (mounts ["root" ])
1560- ipv6_conf .close ()
1549+ with open ("%s/etc/sysctl.d/91-net-ipv6.conf" % mounts ["root" ], "w" ) as ipv6_conf :
1550+ if admin_config .modev6 :
1551+ nfd .write ("NETWORKING_IPV6=yes\n " )
1552+ util .runCmd2 (['chroot' , mounts ['root' ], 'systemctl' , 'enable' , 'ip6tables' ])
1553+ for i in ['all' , 'default' ]:
1554+ ipv6_conf .write ('net.ipv6.conf.%s.disable_ipv6=0\n ' % i )
1555+ else :
1556+ nfd .write ("NETWORKING_IPV6=no\n " )
1557+ for i in ['all' , 'default' ]:
1558+ ipv6_conf .write ('net.ipv6.conf.%s.disable_ipv6=1\n ' % i )
1559+ netutil .disable_ipv6_module (mounts ["root" ])
15611560 nfd .write ("IPV6_AUTOCONF=no\n " )
15621561 nfd .write ('NTPSERVERARGS="iburst prefer"\n ' )
15631562 nfd .close ()
0 commit comments