core: fix Dispatcher and SECNode opts handling
both tried to consume everything before, also making the check for unknown options afterwards pointless Change-Id: I7e44c088163e0b99ac509a2c0f757270807d97ab Fixes: #4912 Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/34837 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Georg Brandl <g.brandl@fz-juelich.de>
This commit is contained in:
@ -56,11 +56,6 @@ def make_update(modulename, pobj):
|
|||||||
|
|
||||||
class Dispatcher:
|
class Dispatcher:
|
||||||
def __init__(self, name, logger, options, srv):
|
def __init__(self, name, logger, options, srv):
|
||||||
# to avoid errors, we want to eat all options here
|
|
||||||
self.equipment_id = options.pop('equipment_id', name)
|
|
||||||
self.nodeprops = {}
|
|
||||||
for k in list(options):
|
|
||||||
self.nodeprops[k] = options.pop(k)
|
|
||||||
|
|
||||||
self.log = logger
|
self.log = logger
|
||||||
self.secnode = srv.secnode
|
self.secnode = srv.secnode
|
||||||
|
@ -40,8 +40,6 @@ class SecNode:
|
|||||||
def __init__(self, name, logger, options, srv):
|
def __init__(self, name, logger, options, srv):
|
||||||
self.equipment_id = options.pop('equipment_id', name)
|
self.equipment_id = options.pop('equipment_id', name)
|
||||||
self.nodeprops = {}
|
self.nodeprops = {}
|
||||||
for k in list(options):
|
|
||||||
self.nodeprops[k] = options.pop(k)
|
|
||||||
# map ALL modulename -> moduleobj
|
# map ALL modulename -> moduleobj
|
||||||
self.modules = {}
|
self.modules = {}
|
||||||
# list of EXPORTED modules
|
# list of EXPORTED modules
|
||||||
|
@ -268,8 +268,10 @@ class Server:
|
|||||||
self.secnode = SecNode(name, self.log.getChild('secnode'), opts, self)
|
self.secnode = SecNode(name, self.log.getChild('secnode'), opts, self)
|
||||||
self.dispatcher = cls(name, self.log.getChild('dispatcher'), opts, self)
|
self.dispatcher = cls(name, self.log.getChild('dispatcher'), opts, self)
|
||||||
|
|
||||||
if opts:
|
# add other options as SECNode properties, those with '_' prefixed will
|
||||||
self.secnode.errors.append(self.unknown_options(cls, opts))
|
# get exported
|
||||||
|
for k in list(opts):
|
||||||
|
self.secnode.add_secnode_property(k, opts.pop(k))
|
||||||
|
|
||||||
self.secnode.create_modules()
|
self.secnode.create_modules()
|
||||||
# initialize all modules by getting them with Dispatcher.get_module,
|
# initialize all modules by getting them with Dispatcher.get_module,
|
||||||
|
Reference in New Issue
Block a user