mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-18 06:18:08 +00:00
parent
9b0088728f
commit
a581eeba54
@ -24,6 +24,7 @@ import logging
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
import urllib
|
import urllib
|
||||||
import json
|
import json
|
||||||
|
from pkg_resources import parse_version
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -32,6 +33,8 @@ from ..project_manager import ProjectManager
|
|||||||
from .docker_vm import DockerVM
|
from .docker_vm import DockerVM
|
||||||
from .docker_error import *
|
from .docker_error import *
|
||||||
|
|
||||||
|
DOCKER_MINIMUM_API_VERSION = "1.21"
|
||||||
|
|
||||||
|
|
||||||
class Docker(BaseManager):
|
class Docker(BaseManager):
|
||||||
|
|
||||||
@ -50,10 +53,13 @@ class Docker(BaseManager):
|
|||||||
try:
|
try:
|
||||||
self._connector = aiohttp.connector.UnixConnector(self._server_url)
|
self._connector = aiohttp.connector.UnixConnector(self._server_url)
|
||||||
self._connected = True
|
self._connected = True
|
||||||
yield from self.query("GET", "info")
|
version = yield from self.query("GET", "version")
|
||||||
except (aiohttp.errors.ClientOSError, FileNotFoundError):
|
except (aiohttp.errors.ClientOSError, FileNotFoundError):
|
||||||
self._connected = False
|
self._connected = False
|
||||||
raise DockerError("Can't connect to docker daemon")
|
raise DockerError("Can't connect to docker daemon")
|
||||||
|
|
||||||
|
if parse_version(version["ApiVersion"]) < parse_version(DOCKER_MINIMUM_API_VERSION):
|
||||||
|
raise DockerError("Docker API version is {}. But GNS3 require a minimum API version {}".format(version["ApiVersion"], DOCKER_MINIMUM_API_VERSION))
|
||||||
return self._connector
|
return self._connector
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user