@@ -1553,18 +1553,17 @@ def configureNetworking(mounts, admin_iface, admin_bridge, admin_config, hn_conf
15531553 # now we need to write /etc/sysconfig/network
15541554 nfd = open ("%s/etc/sysconfig/network" % mounts ["root" ], "w" )
15551555 nfd .write ("NETWORKING=yes\n " )
1556- ipv6_conf = open ("%s/etc/sysctl.d/91-net-ipv6.conf" % mounts ["root" ], "w" )
1557- if admin_config .modev6 :
1558- nfd .write ("NETWORKING_IPV6=yes\n " )
1559- util .runCmd2 (['chroot' , mounts ['root' ], 'systemctl' , 'enable' , 'ip6tables' ])
1560- for i in ['all' , 'default' ]:
1561- ipv6_conf .write ('net.ipv6.conf.%s.disable_ipv6=0\n ' % i )
1562- else :
1563- nfd .write ("NETWORKING_IPV6=no\n " )
1564- for i in ['all' , 'default' ]:
1565- ipv6_conf .write ('net.ipv6.conf.%s.disable_ipv6=1\n ' % i )
1566- netutil .disable_ipv6_module (mounts ["root" ])
1567- ipv6_conf .close ()
1556+ with open ("%s/etc/sysctl.d/91-net-ipv6.conf" % mounts ["root" ], "w" ) as ipv6_conf :
1557+ if admin_config .modev6 :
1558+ nfd .write ("NETWORKING_IPV6=yes\n " )
1559+ util .runCmd2 (['chroot' , mounts ['root' ], 'systemctl' , 'enable' , 'ip6tables' ])
1560+ for i in ['all' , 'default' ]:
1561+ ipv6_conf .write ('net.ipv6.conf.%s.disable_ipv6=0\n ' % i )
1562+ else :
1563+ nfd .write ("NETWORKING_IPV6=no\n " )
1564+ for i in ['all' , 'default' ]:
1565+ ipv6_conf .write ('net.ipv6.conf.%s.disable_ipv6=1\n ' % i )
1566+ netutil .disable_ipv6_module (mounts ["root" ])
15681567 nfd .write ("IPV6_AUTOCONF=no\n " )
15691568 nfd .write ('NTPSERVERARGS="iburst prefer"\n ' )
15701569 nfd .close ()
0 commit comments