daemon: fixed issue starting session and clearing session options, small cleanup to SessionOptions init

This commit is contained in:
Blake Harnden 2022-04-01 11:46:28 -07:00
parent 08637d35b3
commit 9d97699b1f
3 changed files with 6 additions and 9 deletions

View file

@ -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)

View file

@ -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

View file

@ -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,