mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-13 20:08:55 +00:00
Merge branch '2.2' into 3.0
# Conflicts: # gns3server/compute/docker/docker_vm.py # gns3server/controller/__init__.py # gns3server/controller/appliance_manager.py # gns3server/web/route.py # requirements.txt # tests/compute/docker/test_docker_vm.py
This commit is contained in:
commit
1ec056c1a6
@ -488,8 +488,8 @@ class DockerVM(BaseNode):
|
||||
params["Env"].append(f"DISPLAY=:{self._display}")
|
||||
params["HostConfig"]["Mounts"].append({
|
||||
"Type": "bind",
|
||||
"Source": "/tmp/.X11-unix/",
|
||||
"Target": "/tmp/.X11-unix/"
|
||||
"Source": f"/tmp/.X11-unix/X{self._display}",
|
||||
"Target": f"/tmp/.X11-unix/X{self._display}"
|
||||
})
|
||||
|
||||
if self._extra_hosts:
|
||||
|
@ -270,9 +270,12 @@ class Controller:
|
||||
log.error(f"Cannot read IOU license file '{iourc_path}': {e}")
|
||||
self._iou_license_settings["license_check"] = iou_config.license_check
|
||||
|
||||
current_version = __version__.split("+")[0]
|
||||
previous_version = controller_vars.get("version", "").split("+")[0]
|
||||
if not previous_version or parse_version(current_version) > parse_version(previous_version):
|
||||
previous_version = controller_settings.get("version")
|
||||
log.info("Comparing controller version {} with config version {}".format(__version__, previous_version))
|
||||
if not previous_version or \
|
||||
parse_version(__version__.split("+")[0]) > parse_version(previous_version.split("+")[0]):
|
||||
self._appliance_manager.install_builtin_appliances()
|
||||
elif not os.listdir(self._appliance_manager.builtin_appliances_path()):
|
||||
self._appliance_manager.install_builtin_appliances()
|
||||
|
||||
self._appliance_manager.appliances_etag = controller_vars.get("appliances_etag")
|
||||
|
@ -21,6 +21,7 @@ import json
|
||||
import asyncio
|
||||
import aiofiles
|
||||
import shutil
|
||||
import platformdirs
|
||||
|
||||
|
||||
from typing import Tuple, List
|
||||
@ -94,13 +95,13 @@ class ApplianceManager:
|
||||
os.makedirs(appliances_path, exist_ok=True)
|
||||
return appliances_path
|
||||
|
||||
def _builtin_appliances_path(self, delete_first=False):
|
||||
def builtin_appliances_path(self, delete_first=False):
|
||||
"""
|
||||
Get the built-in appliance storage directory
|
||||
"""
|
||||
|
||||
config = Config.instance()
|
||||
appliances_dir = os.path.join(config.config_dir, "appliances")
|
||||
appname = vendor = "GNS3"
|
||||
appliances_dir = os.path.join(platformdirs.user_data_dir(appname, vendor, roaming=True), "appliances")
|
||||
if delete_first:
|
||||
shutil.rmtree(appliances_dir, ignore_errors=True)
|
||||
os.makedirs(appliances_dir, exist_ok=True)
|
||||
@ -111,7 +112,7 @@ class ApplianceManager:
|
||||
At startup we copy the built-in appliances files.
|
||||
"""
|
||||
|
||||
dst_path = self._builtin_appliances_path(delete_first=True)
|
||||
dst_path = self.builtin_appliances_path(delete_first=True)
|
||||
log.info(f"Installing built-in appliances in '{dst_path}'")
|
||||
from . import Controller
|
||||
try:
|
||||
@ -316,7 +317,7 @@ class ApplianceManager:
|
||||
self._appliances = {}
|
||||
for directory, builtin in (
|
||||
(
|
||||
self._builtin_appliances_path(),
|
||||
self.builtin_appliances_path(),
|
||||
True,
|
||||
),
|
||||
(
|
||||
@ -434,7 +435,7 @@ class ApplianceManager:
|
||||
|
||||
Controller.instance().save()
|
||||
json_data = await response.json()
|
||||
appliances_dir = self._builtin_appliances_path()
|
||||
appliances_dir = self.builtin_appliances_path()
|
||||
downloaded_appliance_files = []
|
||||
for appliance in json_data:
|
||||
if appliance["type"] == "file":
|
||||
|
@ -18,4 +18,5 @@ python-jose==3.3.0
|
||||
email-validator==2.0.0.post2
|
||||
watchfiles==0.20.0
|
||||
zstandard==0.21.0
|
||||
platformdirs==2.4.0
|
||||
importlib_resources>=1.3
|
||||
|
@ -222,8 +222,9 @@ async def test_create_vnc(compute_project, manager):
|
||||
},
|
||||
{
|
||||
"Type": "bind",
|
||||
"Source": "/tmp/.X11-unix/",
|
||||
"Target": "/tmp/.X11-unix/"
|
||||
"Source": f"/tmp/.X11-unix/X{vm._display}",
|
||||
"Target": f"/tmp/.X11-unix/X{vm._display}",
|
||||
"ReadOnly": True
|
||||
}
|
||||
],
|
||||
"Privileged": True,
|
||||
|
Loading…
Reference in New Issue
Block a user