diff --git a/daemon/core/api/grpc/server.py b/daemon/core/api/grpc/server.py index 18a97992..4bc5aab1 100644 --- a/daemon/core/api/grpc/server.py +++ b/daemon/core/api/grpc/server.py @@ -262,7 +262,6 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer): session.set_user(request.session.user) # session options - session.options.config_reset() for option in request.session.options.values(): session.options.set_config(option.name, option.value) session.metadata = dict(request.session.metadata) diff --git a/daemon/core/emulator/session.py b/daemon/core/emulator/session.py index 4cae8a77..3af449fc 100644 --- a/daemon/core/emulator/session.py +++ b/daemon/core/emulator/session.py @@ -147,12 +147,7 @@ class Session: self.config_handlers: List[Callable[[ConfigData], None]] = [] # session options/metadata - self.options: SessionConfig = SessionConfig() - if not config: - config = {} - for key in config: - value = config[key] - self.options.set_config(key, value) + self.options: SessionConfig = SessionConfig(config) self.metadata: Dict[str, str] = {} # distributed support and logic diff --git a/daemon/core/emulator/sessionconfig.py b/daemon/core/emulator/sessionconfig.py index 028d4e66..3ffa051d 100644 --- a/daemon/core/emulator/sessionconfig.py +++ b/daemon/core/emulator/sessionconfig.py @@ -1,4 +1,4 @@ -from typing import Any, List +from typing import Any, Dict, List from core.config import ( ConfigBool, @@ -44,9 +44,12 @@ class SessionConfig(ConfigurableManager, ConfigurableOptions): ] config_type: RegisterTlvs = RegisterTlvs.UTILITY - def __init__(self) -> None: + def __init__(self, config: Dict[str, str] = None) -> None: super().__init__() self.set_configs(self.default_values()) + if config: + for key, value in config.items(): + self.set_config(key, value) def get_config( self,