mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-17 01:04:51 +02:00
Do not require the local server param to open a .gns3 file. Fixes https://github.com/GNS3/gns3-gui/issues/2421 Ref #1460
This commit is contained in:
parent
16fcf6141e
commit
ab4d964d69
@ -204,12 +204,7 @@ async def load_project(path: str = Body(..., embed=True)) -> schemas.Project:
|
||||
|
||||
controller = Controller.instance()
|
||||
dot_gns3_file = path
|
||||
if Config.instance().settings.Server.local is False:
|
||||
log.error(f"Cannot load '{dot_gns3_file}' because the server has not been started with the '--local' parameter")
|
||||
raise ControllerForbiddenError("Cannot load project when server is not local")
|
||||
project = await controller.load_project(
|
||||
dot_gns3_file,
|
||||
)
|
||||
project = await controller.load_project(dot_gns3_file)
|
||||
return project.asdict()
|
||||
|
||||
|
||||
|
@ -519,6 +519,9 @@ class Controller:
|
||||
:param load: Load the topology
|
||||
"""
|
||||
|
||||
if not os.path.exists(path):
|
||||
raise ControllerError(f"'{path}' does not exist on the controller")
|
||||
|
||||
topo_data = load_topology(path)
|
||||
topo_data.pop("topology")
|
||||
topo_data.pop("version")
|
||||
@ -529,7 +532,10 @@ class Controller:
|
||||
project = self._projects[topo_data["project_id"]]
|
||||
else:
|
||||
project = await self.add_project(
|
||||
path=os.path.dirname(path), status="closed", filename=os.path.basename(path), **topo_data
|
||||
path=os.path.dirname(path),
|
||||
status="closed",
|
||||
filename=os.path.basename(path),
|
||||
**topo_data
|
||||
)
|
||||
if load or project.auto_open:
|
||||
await project.open()
|
||||
|
@ -37,7 +37,7 @@ class QemuTemplate(TemplateBase):
|
||||
default_name_format: Optional[str] = "{name}-{0}"
|
||||
symbol: Optional[str] = ":/symbols/qemu_guest.svg"
|
||||
qemu_path: Optional[str] = Field("", description="Qemu executable path")
|
||||
platform: Optional[QemuPlatform] = Field("i386", description="Platform to emulate")
|
||||
platform: Optional[QemuPlatform] = Field("x86_64", description="Platform to emulate")
|
||||
linked_clone: Optional[bool] = Field(True, description="Whether the VM is a linked clone or not")
|
||||
ram: Optional[int] = Field(256, description="Amount of RAM in MB")
|
||||
cpus: Optional[int] = Field(1, ge=1, le=255, description="Number of vCPUs")
|
||||
|
Loading…
Reference in New Issue
Block a user