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

Make sure IOU licence is dump in ~/

Fix #780
This commit is contained in:
Julien Duponchelle 2016-11-11 16:18:39 +01:00
parent 3bc4e951b8
commit 8dd4f63aca
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -326,6 +326,15 @@ class IOUVM(BaseNode):
def iourc_content(self, value):
if value is not None:
# If we don't save the value in the ~/ the licence is lost at project
# reload
path = os.path.join(os.path.expanduser("~/"), ".iourc")
try:
with open(path, "wb+") as f:
f.write(value.encode("utf-8"))
except OSError as e:
raise IOUError("Could not write the iourc file {}: {}".format(path, e))
path = os.path.join(self.temporary_directory, "iourc")
try:
with open(path, "wb+") as f: