mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 00:08:11 +00:00
Fix docker support in 2.0
This commit is contained in:
parent
234f199558
commit
9cd3231de3
@ -26,7 +26,6 @@ from gns3server.schemas.nio import NIO_SCHEMA
|
||||
from gns3server.schemas.docker import (
|
||||
DOCKER_CREATE_SCHEMA,
|
||||
DOCKER_OBJECT_SCHEMA,
|
||||
DOCKER_UPDATE_SCHEMA,
|
||||
DOCKER_LIST_IMAGES_SCHEMA
|
||||
)
|
||||
|
||||
@ -238,7 +237,7 @@ class DockerHandler:
|
||||
409: "Conflict"
|
||||
},
|
||||
description="Update a Docker instance",
|
||||
input=DOCKER_UPDATE_SCHEMA,
|
||||
input=DOCKER_OBJECT_SCHEMA,
|
||||
output=DOCKER_OBJECT_SCHEMA)
|
||||
def update(request, response):
|
||||
|
||||
|
@ -89,66 +89,6 @@ DOCKER_CREATE_SCHEMA = {
|
||||
"required": ["name", "image"]
|
||||
}
|
||||
|
||||
|
||||
DOCKER_UPDATE_SCHEMA = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "Request validation to update a Docker container",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "Docker container name",
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
},
|
||||
"console": {
|
||||
"description": "Console TCP port",
|
||||
"minimum": 1,
|
||||
"maximum": 65535,
|
||||
"type": ["integer", "null"]
|
||||
},
|
||||
"console_resolution": {
|
||||
"description": "Console resolution for VNC",
|
||||
"type": ["string", "null"],
|
||||
"pattern": "^[0-9]+x[0-9]+$"
|
||||
},
|
||||
"console_type": {
|
||||
"description": "console type",
|
||||
"enum": ["telnet", "vnc", "http", "https"]
|
||||
},
|
||||
"console_http_port": {
|
||||
"description": "Internal port in the container for the HTTP server",
|
||||
"type": "integer",
|
||||
},
|
||||
"console_http_path": {
|
||||
"description": "Path of the web interface",
|
||||
"type": "string",
|
||||
},
|
||||
"aux": {
|
||||
"description": "Auxiliary TCP port",
|
||||
"minimum": 1,
|
||||
"maximum": 65535,
|
||||
"type": ["integer", "null"]
|
||||
},
|
||||
"start_command": {
|
||||
"description": "Docker CMD entry",
|
||||
"type": ["string", "null"],
|
||||
"minLength": 0,
|
||||
},
|
||||
"environment": {
|
||||
"description": "Docker environment variables",
|
||||
"type": ["string", "null"],
|
||||
"minLength": 0,
|
||||
},
|
||||
"adapters": {
|
||||
"description": "Number of adapters",
|
||||
"type": ["integer", "null"],
|
||||
"minimum": 0,
|
||||
"maximum": 99,
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
}
|
||||
|
||||
DOCKER_OBJECT_SCHEMA = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "Docker container instance",
|
||||
@ -196,21 +136,21 @@ DOCKER_OBJECT_SCHEMA = {
|
||||
"type": "string",
|
||||
},
|
||||
"container_id": {
|
||||
"description": "Docker container ID",
|
||||
"description": "Docker container ID Read only",
|
||||
"type": "string",
|
||||
"minLength": 12,
|
||||
"maxLength": 64,
|
||||
"pattern": "^[a-f0-9]+$"
|
||||
},
|
||||
"project_id": {
|
||||
"description": "Project UUID",
|
||||
"description": "Project UUID Read only",
|
||||
"type": "string",
|
||||
"minLength": 36,
|
||||
"maxLength": 36,
|
||||
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
|
||||
},
|
||||
"image": {
|
||||
"description": "Docker image name",
|
||||
"description": "Docker image name Read only",
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
},
|
||||
@ -231,28 +171,15 @@ DOCKER_OBJECT_SCHEMA = {
|
||||
"minLength": 0,
|
||||
},
|
||||
"node_directory": {
|
||||
"description": "Path to the node working directory",
|
||||
"description": "Path to the node working directory Read only",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"description": "VM status",
|
||||
"description": "VM status Read only",
|
||||
"enum": ["started", "stopped", "suspended"]
|
||||
},
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["node_id",
|
||||
"project_id",
|
||||
"image",
|
||||
"container_id",
|
||||
"adapters",
|
||||
"aux",
|
||||
"console",
|
||||
"console_type",
|
||||
"console_resolution",
|
||||
"start_command",
|
||||
"environment",
|
||||
"node_directory",
|
||||
"status"]
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,58 @@
|
||||
{
|
||||
"auto_start": false,
|
||||
"name": "untitled",
|
||||
"project_id": "926e5c9e-887c-41b2-9214-fbd5fb628fe8",
|
||||
"revision": 4,
|
||||
"topology": {
|
||||
"nodes": [
|
||||
{
|
||||
"description": "Docker container",
|
||||
"id": 1,
|
||||
"label": {
|
||||
"color": "#ff000000",
|
||||
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
|
||||
"text": "remote_busybox-1",
|
||||
"x": -20.4453125,
|
||||
"y": -25.0
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"adapter_number": 0,
|
||||
"id": 1,
|
||||
"name": "eth0",
|
||||
"port_number": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"adapters": 1,
|
||||
"aux": 6002,
|
||||
"console": 6001,
|
||||
"console_http_path": "/",
|
||||
"console_http_port": 80,
|
||||
"console_resolution": "1024x768",
|
||||
"console_type": "telnet",
|
||||
"image": "busybox:latest",
|
||||
"name": "remote_busybox-1"
|
||||
},
|
||||
"server_id": 2,
|
||||
"type": "DockerVM",
|
||||
"vm_id": "d397ef5a-84f1-4b6b-9d44-671937ec7781",
|
||||
"x": -53.5,
|
||||
"y": -69.5
|
||||
}
|
||||
],
|
||||
"servers": [
|
||||
{
|
||||
"host": "127.0.0.1",
|
||||
"id": 2,
|
||||
"local": false,
|
||||
"port": 8001,
|
||||
"protocol": "http",
|
||||
"user": "",
|
||||
"vm": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "topology",
|
||||
"version": "1.5.1dev1"
|
||||
}
|
Loading…
Reference in New Issue
Block a user