diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py index 7b8c3768..1dc2efdb 100644 --- a/gns3server/controller/project.py +++ b/gns3server/controller/project.py @@ -363,8 +363,9 @@ class Project: topo = project_to_topology(self) path = self._topology_file() log.debug("Write %s", path) - with open(path, "w+") as f: + with open(path + ".tmp", "w+") as f: json.dump(topo, f, indent=4, sort_keys=True) + shutil.move(path + ".tmp", path) except OSError as e: raise aiohttp.web.HTTPInternalServerError(text="Could not write topology: {}".format(e))