1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-13 20:08:55 +00:00

Change behavior when an IOU license is verified. Fixes https://github.com/GNS3/gns3-server/issues/1555

This commit is contained in:
grossmj 2019-05-20 10:51:24 +07:00
parent e8b8554c1a
commit 28004479fd
2 changed files with 6 additions and 6 deletions

View File

@ -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"

View File

@ -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)