1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-25 16:28:11 +00:00

Catch error when we can't backup the topology

Fix #998
This commit is contained in:
Julien Duponchelle 2017-05-03 17:35:10 +02:00
parent 8e5f7d0838
commit fa1450cb24
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -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: