mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 16:28:11 +00:00
Fix command line issue with certfile and certkey
This commit is contained in:
parent
66dd8bdadb
commit
cefa459721
@ -146,7 +146,6 @@ class ServerSettings(BaseModel):
|
||||
enable_builtin_templates: bool = True
|
||||
model_config = ConfigDict(validate_assignment=True, str_strip_whitespace=True, use_enum_values=True)
|
||||
|
||||
|
||||
@field_validator("additional_images_paths", mode="before")
|
||||
@classmethod
|
||||
def split_additional_images_paths(cls, v):
|
||||
@ -154,7 +153,6 @@ class ServerSettings(BaseModel):
|
||||
return v.split(";")
|
||||
return list()
|
||||
|
||||
|
||||
@field_validator("allowed_interfaces", mode="before")
|
||||
@classmethod
|
||||
def split_allowed_interfaces(cls, v):
|
||||
@ -162,27 +160,24 @@ class ServerSettings(BaseModel):
|
||||
return v.split(",")
|
||||
return list()
|
||||
|
||||
|
||||
@model_validator(mode="after")
|
||||
def check_console_port_range(self) -> "ServerSettings":
|
||||
if self.console_end_port_range <= self.console_start_port_range:
|
||||
raise ValueError("console_end_port_range must be > console_start_port_range")
|
||||
return self
|
||||
|
||||
|
||||
@model_validator(mode="after")
|
||||
def check_vnc_port_range(self) -> "ServerSettings":
|
||||
if self.vnc_console_end_port_range <= self.vnc_console_start_port_range:
|
||||
raise ValueError("vnc_console_end_port_range must be > vnc_console_start_port_range")
|
||||
return self
|
||||
|
||||
|
||||
@model_validator(mode="after")
|
||||
def check_enable_ssl(self) -> "ServerSettings":
|
||||
if self.enable_ssl is True:
|
||||
if self.certfile is None:
|
||||
if not self.certfile:
|
||||
raise ValueError("SSL is enabled but certfile is not configured")
|
||||
if self.certkey is None:
|
||||
if not self.certkey:
|
||||
raise ValueError("SSL is enabled but certkey is not configured")
|
||||
return self
|
||||
|
||||
|
@ -167,8 +167,10 @@ class Server:
|
||||
config.Server.allow_remote_console = args.allow
|
||||
config.Server.host = args.host
|
||||
config.Server.port = args.port
|
||||
config.Server.certfile = args.certfile
|
||||
config.Server.certkey = args.certkey
|
||||
if args.certfile:
|
||||
config.Server.certfile = args.certfile
|
||||
if args.certkey:
|
||||
config.Server.certkey = args.certkey
|
||||
config.Server.enable_ssl = args.ssl
|
||||
|
||||
def _signal_handling(self):
|
||||
|
Loading…
Reference in New Issue
Block a user