From 28004479fddbc75b4452ae2eea2e2192d6f5e513 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 20 May 2019 10:51:24 +0700 Subject: [PATCH] Change behavior when an IOU license is verified. Fixes https://github.com/GNS3/gns3-server/issues/1555 --- gns3server/compute/iou/iou_vm.py | 8 ++++---- gns3server/controller/node.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gns3server/compute/iou/iou_vm.py b/gns3server/compute/iou/iou_vm.py index 337624ca..6db57636 100644 --- a/gns3server/compute/iou/iou_vm.py +++ b/gns3server/compute/iou/iou_vm.py @@ -342,7 +342,7 @@ class IOUVM(BaseNode): @iourc_content.setter def iourc_content(self, value): - if value is not None: + if value: # If we don't save the value in the ~/ the licence is lost at project # reload path = os.path.join(os.path.expanduser("~/"), ".iourc") @@ -402,6 +402,7 @@ class IOUVM(BaseNode): raise IOUError("Invalid licence check setting") if server_wide_license_check is False: + log.warning("License check is explicitly disabled on this server") return config = configparser.ConfigParser() @@ -508,7 +509,7 @@ class IOUVM(BaseNode): iourc_path = self.iourc_path if not iourc_path: - raise IOUError("Could not find an iourc file (IOU license)") + raise IOUError("Could not find an iourc file (IOU license), please configure an IOU license") if not os.path.isfile(iourc_path): raise IOUError("The iourc path '{}' is not a regular file".format(iourc_path)) @@ -528,8 +529,7 @@ class IOUVM(BaseNode): # created a environment variable pointing to the iourc file. env = os.environ.copy() - - if "IOURC" not in os.environ: + if "IOURC" not in os.environ and iourc_path: env["IOURC"] = iourc_path # create a symbolic link to the image to avoid IOU error "failed code signing checks" diff --git a/gns3server/controller/node.py b/gns3server/controller/node.py index fb8576a3..4d8e81d9 100644 --- a/gns3server/controller/node.py +++ b/gns3server/controller/node.py @@ -495,8 +495,8 @@ class Node: if self.node_type == "iou": license_check = self._project.controller.iou_license.get("license_check", True) iourc_content = self._project.controller.iou_license.get("iourc_content", None) - if license_check and not iourc_content: - raise aiohttp.web.HTTPConflict(text="IOU licence is not configured") + #if license_check and not iourc_content: + # raise aiohttp.web.HTTPConflict(text="IOU licence is not configured") await self.post("/start", timeout=240, data={"license_check": license_check, "iourc_content": iourc_content}) else: await self.post("/start", data=data, timeout=240)