mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Change behavior when an IOU license is verified. Fixes https://github.com/GNS3/gns3-server/issues/1555
This commit is contained in:
parent
e8b8554c1a
commit
28004479fd
@ -342,7 +342,7 @@ class IOUVM(BaseNode):
|
|||||||
@iourc_content.setter
|
@iourc_content.setter
|
||||||
def iourc_content(self, value):
|
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
|
# If we don't save the value in the ~/ the licence is lost at project
|
||||||
# reload
|
# reload
|
||||||
path = os.path.join(os.path.expanduser("~/"), ".iourc")
|
path = os.path.join(os.path.expanduser("~/"), ".iourc")
|
||||||
@ -402,6 +402,7 @@ class IOUVM(BaseNode):
|
|||||||
raise IOUError("Invalid licence check setting")
|
raise IOUError("Invalid licence check setting")
|
||||||
|
|
||||||
if server_wide_license_check is False:
|
if server_wide_license_check is False:
|
||||||
|
log.warning("License check is explicitly disabled on this server")
|
||||||
return
|
return
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
@ -508,7 +509,7 @@ class IOUVM(BaseNode):
|
|||||||
|
|
||||||
iourc_path = self.iourc_path
|
iourc_path = self.iourc_path
|
||||||
if not 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):
|
if not os.path.isfile(iourc_path):
|
||||||
raise IOUError("The iourc path '{}' is not a regular file".format(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.
|
# created a environment variable pointing to the iourc file.
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
|
if "IOURC" not in os.environ and iourc_path:
|
||||||
if "IOURC" not in os.environ:
|
|
||||||
env["IOURC"] = iourc_path
|
env["IOURC"] = iourc_path
|
||||||
|
|
||||||
# create a symbolic link to the image to avoid IOU error "failed code signing checks"
|
# create a symbolic link to the image to avoid IOU error "failed code signing checks"
|
||||||
|
@ -495,8 +495,8 @@ class Node:
|
|||||||
if self.node_type == "iou":
|
if self.node_type == "iou":
|
||||||
license_check = self._project.controller.iou_license.get("license_check", True)
|
license_check = self._project.controller.iou_license.get("license_check", True)
|
||||||
iourc_content = self._project.controller.iou_license.get("iourc_content", None)
|
iourc_content = self._project.controller.iou_license.get("iourc_content", None)
|
||||||
if license_check and not iourc_content:
|
#if license_check and not iourc_content:
|
||||||
raise aiohttp.web.HTTPConflict(text="IOU licence is not configured")
|
# 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})
|
await self.post("/start", timeout=240, data={"license_check": license_check, "iourc_content": iourc_content})
|
||||||
else:
|
else:
|
||||||
await self.post("/start", data=data, timeout=240)
|
await self.post("/start", data=data, timeout=240)
|
||||||
|
Loading…
Reference in New Issue
Block a user