Do not require the local server param to open a .gns3 file. Fixes https://github.com/GNS3/gns3-gui/issues/2421 Ref #1460

pull/2025/head
grossmj 3 years ago
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…
Cancel
Save