1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-18 14:28:08 +00:00

Catch error and log them when we can't write the config

Fix #974
This commit is contained in:
Julien Duponchelle 2017-04-10 17:44:09 +02:00
parent fdd1084714
commit ab2af5ceab
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -146,9 +146,12 @@ class Controller:
"password": c.password,
"compute_id": c.id
})
os.makedirs(os.path.dirname(self._config_file), exist_ok=True)
with open(self._config_file, 'w+') as f:
json.dump(data, f, indent=4)
try:
os.makedirs(os.path.dirname(self._config_file), exist_ok=True)
with open(self._config_file, 'w+') as f:
json.dump(data, f, indent=4)
except OSError as e:
log.error("Can't write the configuration {}: {}".format(self._config_file, str(e)))
@asyncio.coroutine
def _load_controller_settings(self):