diff --git a/sbin/linuxmuster-import-subnets b/sbin/linuxmuster-import-subnets index d37c950..f82ffcc 100755 --- a/sbin/linuxmuster-import-subnets +++ b/sbin/linuxmuster-import-subnets @@ -2,7 +2,7 @@ # # linuxmuster-import-subnets # thomas@linuxmuster.net -# 20211219 +# 20230725 # import ast @@ -84,43 +84,6 @@ nat_rule_xml = nat_rule_xml.replace( # functions begin -# update static routes in netplan configuration -def updateNetplan(subnets): - printScript('Processing netplan configuration:') - cfgfile = constants.NETCFG - # read netplan config file - with open(cfgfile) as config: - netcfg = yaml.safe_load(config) - iface = str(netcfg['network']['ethernets']).split('\'')[1] - ifcfg = netcfg['network']['ethernets'][iface] - # first delete the old routes if there are any - try: - del ifcfg['routes'] - changed = True - printScript('* Removed old routes.') - except: - changed = False - # only if there are subnets beside server network - if len(subnets) > 0: - changed = True - ifcfg['routes'] = [] - for item in subnets: - subnet = item.split(':')[0] - # tricky: concenate dict object for yaml using eval - subroute = eval('{"to": ' + '\'' + subnet + '\'' - + ', "via": ' + '\'' + servernet_router + '\'' + '}') - ifcfg['routes'].append(subroute) - printScript('* Added new routes for all subnets.') - # save netcfg - if changed: - with open(cfgfile, 'w') as config: - config.write(yaml.dump(netcfg, default_flow_style=False)) - os.system('netplan apply') - printScript('* Applied new configuration.') - # send changed configuration back and apply it - return changed - - # update vlan gateway on firewall def updateFwGw(servernet_router, content): soup = BeautifulSoup(content, 'lxml') @@ -360,9 +323,6 @@ else: os.system('systemctl restart isc-dhcp-server.service') -# update netplan config with new routes for server (localhost) -changed = updateNetplan(subnets) - # update firewall if not skipfw: changed = updateFw(subnets, firewallip, ipnet_setup,