From fa1450cb244e0cdbe0785c503ce44994ccc8b69f Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 3 May 2017 17:35:10 +0200 Subject: [PATCH] Catch error when we can't backup the topology Fix #998 --- gns3server/controller/topology.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 5008817f..ee16c0d2 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -125,7 +125,10 @@ def load_topology(path): if "revision" not in topo or topo["revision"] < GNS3_FILE_FORMAT_REVISION: # If it's an old GNS3 file we need to convert it # first we backup the file - shutil.copy(path, path + ".backup{}".format(topo.get("revision", 0))) + try: + shutil.copy(path, path + ".backup{}".format(topo.get("revision", 0))) + except (OSError) as e: + raise aiohttp.web.HTTPConflict(text="Can't write backup of the topology {}: {}".format(path, str(e))) changed = True if "revision" not in topo or topo["revision"] < 5: