Merge branch '3.1' into mypy-compute-project

This commit is contained in:
Jeremy Grossmann 2026-09-28 10:55:25 +02:00 committed by GitHub
commit 10b5c1bb6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 9 deletions

View File

@ -36,7 +36,7 @@ async def root():
@router.get("/debug", response_class=HTMLResponse, deprecated=True, include_in_schema=False)
def debug(request: Request):
kwargs = {"gns3_version": __version__, "gns3_host": request.client.host}
kwargs = {"gns3_version": __version__, "gns3_host": request.client.host if request.client else None}
return templates.TemplateResponse(request=request, name="index.html", context=kwargs)

View File

@ -48,6 +48,10 @@ class ConfigConflictError(Exception):
LIST_OPTION_SEPARATORS = {"additional_images_paths": ";"}
def parser_sections(parser: configparser.ConfigParser) -> dict[str, dict[str, str]]:
return {section: dict(parser[section]) for section in parser.sections()}
class Config:
"""
Configuration file management using configparser.
@ -328,7 +332,7 @@ class Config:
changed.append(f"{section}.{option}")
# validate the merged settings before touching the file on disk
ServerConfig(**merged_parser._sections)
ServerConfig(**parser_sections(merged_parser))
directory_name = os.path.dirname(main_config_file)
if directory_name:
@ -414,7 +418,7 @@ class Config:
self._watched_files[file] = os.stat(file).st_mtime
try:
self._settings = ServerConfig(**config._sections)
self._settings = ServerConfig(**parser_sections(config))
except ValidationError as e:
log.critical(f"Could not validate configuration file settings: {e}")
raise

View File

@ -236,12 +236,11 @@ class ShellConnection(TelnetConnection):
async def disconnected(self):
pass
@asyncio.coroutine
def window_size_changed(self, columns, rows):
async def window_size_changed(self, columns, rows):
self._size = Size(rows=rows, columns=columns)
self._cb.terminal_size_changed()
if self._window_size_changed_callback:
yield from self._window_size_changed_callback(columns, rows)
await self._window_size_changed_callback(columns, rows)
async def feed(self, data):
data = data.decode()

View File

@ -359,7 +359,6 @@ module = [
"gns3server.api.routes.controller.snapshots", # 1
"gns3server.api.routes.controller.templates", # 10
"gns3server.api.routes.controller.users", # 14
"gns3server.api.routes.index", # 1
"gns3server.api.server", # 2
"gns3server.compute.docker.docker_vm", # 3
"gns3server.compute.docker.iol_docker_vm", # 3
@ -371,7 +370,6 @@ module = [
"gns3server.compute.virtualbox.virtualbox_vm", # 1
"gns3server.compute.vmware.vmware_vm", # 1
"gns3server.compute.vpcs.vpcs_vm", # 2
"gns3server.config", # 1
"gns3server.controller.appliance", # 2
"gns3server.controller.appliance_manager", # 5
"gns3server.controller.compute", # 2
@ -420,7 +418,6 @@ module = [
"gns3server.services.computes", # 4
"gns3server.services.templates", # 18
"gns3server.utils.asyncio.aiozipstream", # 8
"gns3server.utils.asyncio.embed_shell", # 1
"gns3server.utils.encryption", # 2
"gns3server.utils.http_client", # 4
"gns3server.utils.images", # 4