From 9ee1d9d71a19019eb04572c3adb3f036a1b0162a Mon Sep 17 00:00:00 2001 From: Goran Cetusic Date: Mon, 15 Jun 2015 19:30:09 +0200 Subject: [PATCH] fixed the way docker containers are terminated --- gns3server/modules/docker/__init__.py | 3 ++- gns3server/modules/docker/docker_vm.py | 2 +- gns3server/schemas/docker.py | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/docker/__init__.py b/gns3server/modules/docker/__init__.py index 49a7f4b1..786ce1ea 100644 --- a/gns3server/modules/docker/__init__.py +++ b/gns3server/modules/docker/__init__.py @@ -25,6 +25,7 @@ import shutil import asyncio import subprocess import logging +import aiohttp import docker log = logging.getLogger(__name__) @@ -126,7 +127,7 @@ class Docker(BaseManager): if cid not in self._vms: raise aiohttp.web.HTTPNotFound( - text="Docker container with ID {} doesn't exist".format(vm_id)) + text="Docker container with ID {} doesn't exist".format(cid)) container = self._vms[cid] if project_id: diff --git a/gns3server/modules/docker/docker_vm.py b/gns3server/modules/docker/docker_vm.py index d08cff02..e70c982c 100644 --- a/gns3server/modules/docker/docker_vm.py +++ b/gns3server/modules/docker/docker_vm.py @@ -128,7 +128,7 @@ class Container(BaseVM): def stop(self): """Stops this Docker container.""" result = yield from self.manager.execute( - "stop", {"container": self._id}) + "kill", {"container": self._id}) log.info("Docker container '{name}' [{image}] stopped".format( name=self._name, image=self._image)) diff --git a/gns3server/schemas/docker.py b/gns3server/schemas/docker.py index 15c03ab3..cb10b7d8 100644 --- a/gns3server/schemas/docker.py +++ b/gns3server/schemas/docker.py @@ -42,6 +42,11 @@ DOCKER_CREATE_SCHEMA = { "type": "string", "minLength": 1, }, + "console": { + "description": "console name", + "type": "string", + "minLength": 1, + }, }, "additionalProperties": False, }