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

Fix bug when changing properties for closed project. Fixes #1754

This commit is contained in:
grossmj 2020-05-26 18:34:20 +09:30
parent 5c3bd589b9
commit 69b816e21e
2 changed files with 18 additions and 6 deletions

View File

@ -437,6 +437,9 @@ class Project:
"""
:return: List of computes used by the project
"""
if self._status == "closed":
return self._get_closed_data("computes", "compute_id").values()
return self._project_created_on_compute
def remove_allocated_node_name(self, name):

View File

@ -99,19 +99,28 @@ def project_to_topology(project):
"version": __version__
}
computes = set()
for node in project.nodes.values():
computes.add(node.compute)
if hasattr(node, "__json__"):
data["topology"]["nodes"].append(node.__json__(topology_dump=True))
else:
data["topology"]["nodes"].append(node)
for link in project.links.values():
if hasattr(link, "__json__"):
data["topology"]["links"].append(link.__json__(topology_dump=True))
else:
data["topology"]["links"].append(link)
for drawing in project.drawings.values():
if hasattr(drawing, "__json__"):
data["topology"]["drawings"].append(drawing.__json__(topology_dump=True))
for compute in computes:
else:
data["topology"]["drawings"].append(drawing)
for compute in project.computes:
if hasattr(compute, "__json__"):
compute = compute.__json__(topology_dump=True)
if compute["compute_id"] not in ("vm", "local", ):
data["topology"]["computes"].append(compute)
else:
data["topology"]["computes"].append(compute)
_check_topology_schema(data)
return data