mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
New packaging relying only pyproject.toml
This commit is contained in:
1 parent
17f71f970e
commit
1cb433c5bc
13 files changed
+38
-82
No files matched your search
@@ -18,11 +18,15 @@
|
||||
Docker server module.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import asyncio
|
||||
import logging
|
||||
import aiohttp
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from gns3server.utils import parse_version
|
||||
from gns3server.utils.asyncio import locking
|
||||
from gns3server.compute.base_manager import BaseManager
|
||||
@@ -54,6 +58,25 @@ class Docker(BaseManager):
|
||||
self._session = None
|
||||
self._api_version = DOCKER_MINIMUM_API_VERSION
|
||||
|
||||
@staticmethod
|
||||
def install_busybox():
|
||||
|
||||
if not sys.platform.startswith("linux"):
|
||||
return
|
||||
dst_busybox = os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources", "bin", "busybox")
|
||||
if os.path.isfile(dst_busybox):
|
||||
return
|
||||
for busybox_exec in ("busybox-static", "busybox.static", "busybox"):
|
||||
busybox_path = shutil.which(busybox_exec)
|
||||
if busybox_path:
|
||||
log.info(f"Installing busybox from '{busybox_path}'")
|
||||
try:
|
||||
shutil.copy2(busybox_path, dst_busybox, follow_symlinks=True)
|
||||
return
|
||||
except OSError as e:
|
||||
raise DockerError(f"Could not install busybox: {e}")
|
||||
raise DockerError("No busybox executable could be found")
|
||||
|
||||
async def _check_connection(self):
|
||||
|
||||
if not self._connected:
|
||||
|
||||
@@ -523,7 +523,7 @@ class DockerVM(BaseNode):
|
||||
|
||||
async def update(self):
|
||||
"""
|
||||
Destroy an recreate the container with the new settings
|
||||
Destroy and recreate the container with the new settings
|
||||
"""
|
||||
|
||||
# We need to save the console and state and restore it
|
||||
@@ -544,6 +544,9 @@ class DockerVM(BaseNode):
|
||||
Starts this Docker container.
|
||||
"""
|
||||
|
||||
# make sure busybox is installed
|
||||
self.manager.install_busybox()
|
||||
|
||||
try:
|
||||
state = await self._get_container_state()
|
||||
except DockerHttp404Error:
|
||||
|
||||
Reference in new issue
Block a user