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:
parent
5c3bd589b9
commit
69b816e21e
@ -437,6 +437,9 @@ class Project:
|
|||||||
"""
|
"""
|
||||||
:return: List of computes used by the 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
|
return self._project_created_on_compute
|
||||||
|
|
||||||
def remove_allocated_node_name(self, name):
|
def remove_allocated_node_name(self, name):
|
||||||
|
@ -99,19 +99,28 @@ def project_to_topology(project):
|
|||||||
"version": __version__
|
"version": __version__
|
||||||
}
|
}
|
||||||
|
|
||||||
computes = set()
|
|
||||||
for node in project.nodes.values():
|
for node in project.nodes.values():
|
||||||
computes.add(node.compute)
|
if hasattr(node, "__json__"):
|
||||||
data["topology"]["nodes"].append(node.__json__(topology_dump=True))
|
data["topology"]["nodes"].append(node.__json__(topology_dump=True))
|
||||||
|
else:
|
||||||
|
data["topology"]["nodes"].append(node)
|
||||||
for link in project.links.values():
|
for link in project.links.values():
|
||||||
data["topology"]["links"].append(link.__json__(topology_dump=True))
|
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():
|
for drawing in project.drawings.values():
|
||||||
data["topology"]["drawings"].append(drawing.__json__(topology_dump=True))
|
if hasattr(drawing, "__json__"):
|
||||||
for compute in computes:
|
data["topology"]["drawings"].append(drawing.__json__(topology_dump=True))
|
||||||
|
else:
|
||||||
|
data["topology"]["drawings"].append(drawing)
|
||||||
|
for compute in project.computes:
|
||||||
if hasattr(compute, "__json__"):
|
if hasattr(compute, "__json__"):
|
||||||
compute = compute.__json__(topology_dump=True)
|
compute = compute.__json__(topology_dump=True)
|
||||||
if compute["compute_id"] not in ("vm", "local", ):
|
if compute["compute_id"] not in ("vm", "local", ):
|
||||||
data["topology"]["computes"].append(compute)
|
data["topology"]["computes"].append(compute)
|
||||||
|
else:
|
||||||
|
data["topology"]["computes"].append(compute)
|
||||||
_check_topology_schema(data)
|
_check_topology_schema(data)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user