From 8dd4f63acab8ac77795b72ddd45f1d41fa7c141d Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 11 Nov 2016 16:18:39 +0100 Subject: [PATCH] Make sure IOU licence is dump in ~/ Fix #780 --- gns3server/compute/iou/iou_vm.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gns3server/compute/iou/iou_vm.py b/gns3server/compute/iou/iou_vm.py index 365714e3..b697f088 100644 --- a/gns3server/compute/iou/iou_vm.py +++ b/gns3server/compute/iou/iou_vm.py @@ -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: