fixed an issue cuaisng router to die

- router should not die when an error happens when connecting to HW
+ install will restart changed network interfaces
This commit is contained in:
2021-03-26 09:30:45 +01:00
parent 53af769c3f
commit a9c1c38d51
3 changed files with 15 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ from ipaddress import IPv4Interface
from configparser import ConfigParser
from os.path import join, getmtime, exists
os.chdir('to_system')
os.chdir('/root/aputools/to_system')
DEL = '__to_delete__'
CFGPATH = '/root/aputools/servercfg/%s.cfg'
@@ -173,6 +173,8 @@ def network(doit):
if doit:
with open('/etc/sysconfig/network-scripts/ifcfg-%s' % ifname, 'w') as f:
f.write('%s\n' % '\n'.join('%s=%s' % kv for kv in content.items()))
os.system('ifdown %s' % ifname)
os.system('ifup %s' % ifname)
else:
dirty = 'dirty'
print('%s changed:' % ifname)