From 06bcf94fa2ec1d623c5a7b8c3bfba892bf9dc0de Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Mon, 11 Dec 2023 17:48:16 +0100 Subject: [PATCH] frappy.secnode: fix strange error message when get_module_instance is called a second time after it failed, the 'cls' element in opts is missing: move opts dict copy from create_modules to get_module_instance Change-Id: Ie046f133a8fdbbb1c39643ca16dc5447a9d2d065 Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/32745 Tested-by: Jenkins Automated Tests Reviewed-by: Alexander Zaft Reviewed-by: Enrico Faulhaber Reviewed-by: Markus Zolliker --- frappy/secnode.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frappy/secnode.py b/frappy/secnode.py index b2ea18e..3e16aa6 100644 --- a/frappy/secnode.py +++ b/frappy/secnode.py @@ -84,7 +84,7 @@ class SecNode: def get_module_instance(self, modulename): """ Returns the module in its current initialization state or creates a - new uninitialized modle to return. + new uninitialized module to return. When creating a new module, srv.module_config is accessed to get the modules configuration. @@ -102,6 +102,7 @@ class SecNode: if opts is None: raise NoSuchModuleError(f'Module {modulename!r} does not exist on ' f'this SEC-Node!') + opts = dict(opts) pymodule = None try: # pylint: disable=no-else-return classname = opts.pop('cls') @@ -157,7 +158,7 @@ class SecNode: # already created via Attached continue # For Pinata modules: we need to access this in Self.get_module - self.srv.module_cfg[modname] = dict(options) + self.srv.module_cfg[modname] = options modobj = self.get_module_instance(modname) # lazy if modobj is None: self.log.debug('Module %s returned None', modname)