split out config file reading

+ improve ip and no 'network' on display
This commit is contained in:
2024-03-06 11:48:41 +01:00
parent c3a36879cb
commit ddedf67bf3
6 changed files with 152 additions and 77 deletions

View File

@ -9,7 +9,7 @@ from glob import glob
from select import select
from serial import serial_for_url
from subprocess import Popen, PIPE, check_output, call, DEVNULL
from configparser import ConfigParser
from utils import get_config
FIREWALL_CONF = '/etc/nftables.conf'
@ -477,10 +477,6 @@ class Service:
if __name__ == '__main__':
parser = ConfigParser()
cfgfiles = glob('/home/l_samenv/boxtools/cfg/%s_*.cfg' % socket.gethostname())
if len(cfgfiles) != 1:
raise ValueError('there must be one and only one single cfgfile %r' % cfgfiles)
parser.read(cfgfiles[0])
if parser.has_section('ROUTER'):
Service.run(parser['ROUTER'])
routercfg = get_config('ROUTER')
if routercfg:
Service.run(routercfg)