1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-24 15:58:08 +00:00

Handle builtin entry does not exist when adding node from template (new fix).

This commit is contained in:
grossmj 2019-11-02 16:23:45 +08:00
parent b8c70a3a8e
commit 459dd7b479

View File

@ -503,7 +503,7 @@ class Project:
template["x"] = x template["x"] = x
template["y"] = y template["y"] = y
node_type = template.pop("template_type") node_type = template.pop("template_type")
if template.get("builtin") is True: if template.pop("builtin", False) is True:
# compute_id is selected by clients for builtin templates # compute_id is selected by clients for builtin templates
compute = self.controller.get_compute(compute_id) compute = self.controller.get_compute(compute_id)
else: else:
@ -512,7 +512,6 @@ class Project:
default_name_format = template.pop("default_name_format", "{name}-{0}") default_name_format = template.pop("default_name_format", "{name}-{0}")
name = default_name_format.replace("{name}", name) name = default_name_format.replace("{name}", name)
node_id = str(uuid.uuid4()) node_id = str(uuid.uuid4())
template.pop("builtin") # not needed to add a node
node = await self.add_node(compute, name, node_id, node_type=node_type, **template) node = await self.add_node(compute, name, node_id, node_type=node_type, **template)
return node return node