split out config file reading
+ improve ip and no 'network' on display
This commit is contained in:
12
router.py
12
router.py
@ -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)
|
||||
|
Reference in New Issue
Block a user