mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-04 12:04:12 +00:00
Merge branch '2.2' into 3.0
# Conflicts: # gns3server/compute/iou/iou_vm.py
This commit is contained in:
commit
db067579db
@ -436,14 +436,16 @@ class IOUVM(BaseNode):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _check_iou_licence(self):
|
def _is_iou_licence_check_enabled(self):
|
||||||
"""
|
"""
|
||||||
Checks for a valid IOU key in the iourc file (paranoid mode).
|
Returns if IOU licence check is enabled.
|
||||||
|
|
||||||
|
:return: boolean
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# license check is sent by the controller
|
# license check is sent by the controller
|
||||||
if self.license_check is False:
|
if self.license_check is False:
|
||||||
return
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# we allow license check to be disabled server wide
|
# we allow license check to be disabled server wide
|
||||||
@ -453,7 +455,14 @@ class IOUVM(BaseNode):
|
|||||||
|
|
||||||
if server_wide_license_check is False:
|
if server_wide_license_check is False:
|
||||||
log.warning("License check is explicitly disabled on this server")
|
log.warning("License check is explicitly disabled on this server")
|
||||||
return
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
async def _check_iou_licence(self):
|
||||||
|
"""
|
||||||
|
Checks for a valid IOU key in the iourc file (paranoid mode).
|
||||||
|
"""
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
try:
|
try:
|
||||||
@ -559,6 +568,7 @@ class IOUVM(BaseNode):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise IOUError(f"Could not rename nvram files: {e}")
|
raise IOUError(f"Could not rename nvram files: {e}")
|
||||||
|
|
||||||
|
if self._is_iou_licence_check_enabled():
|
||||||
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), please configure an IOU license")
|
raise IOUError("Could not find an iourc file (IOU license), please configure an IOU license")
|
||||||
@ -566,8 +576,8 @@ class IOUVM(BaseNode):
|
|||||||
raise IOUError(f"The iourc path '{iourc_path}' is not a regular file")
|
raise IOUError(f"The iourc path '{iourc_path}' is not a regular file")
|
||||||
|
|
||||||
await self._check_iou_licence()
|
await self._check_iou_licence()
|
||||||
await self._start_ubridge()
|
|
||||||
|
|
||||||
|
await self._start_ubridge()
|
||||||
self._create_netmap_config()
|
self._create_netmap_config()
|
||||||
if self.use_default_iou_values:
|
if self.use_default_iou_values:
|
||||||
# make sure we have the default nvram amount to correctly push the configs
|
# make sure we have the default nvram amount to correctly push the configs
|
||||||
@ -579,7 +589,7 @@ class IOUVM(BaseNode):
|
|||||||
|
|
||||||
self._nvram_watcher = FileWatcher(self._nvram_file(), self._nvram_changed, delay=2)
|
self._nvram_watcher = FileWatcher(self._nvram_file(), self._nvram_changed, delay=2)
|
||||||
|
|
||||||
# created a environment variable pointing to the iourc file.
|
# created an 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 and iourc_path:
|
||||||
env["IOURC"] = iourc_path
|
env["IOURC"] = iourc_path
|
||||||
|
Loading…
Reference in New Issue
Block a user