Catch error when writting the topology file on read only device

Fix #1003
pull/1027/head
Julien Duponchelle 7 years ago
parent 31d1696215
commit 8e5f7d0838
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -146,8 +146,11 @@ def load_topology(path):
raise e
if changed:
with open(path, "w+", encoding="utf-8") as f:
json.dump(topo, f, indent=4, sort_keys=True)
try:
with open(path, "w+", encoding="utf-8") as f:
json.dump(topo, f, indent=4, sort_keys=True)
except (OSError) as e:
raise aiohttp.web.HTTPConflict(text="Can't write the topology {}: {}".format(path, str(e)))
return topo

Loading…
Cancel
Save