From 05df7001a393327d8bfc7345f2011ff46f32a1b2 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 12 Feb 2015 17:03:01 +0100 Subject: [PATCH] Successfully create an iou device from the GUI via HTTP --- gns3server/main.py | 1 - gns3server/modules/iou/iou_vm.py | 6 +++--- gns3server/schemas/iou.py | 24 ++++++++++++++++-------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/gns3server/main.py b/gns3server/main.py index 991f8cce..f25ce6d9 100644 --- a/gns3server/main.py +++ b/gns3server/main.py @@ -108,7 +108,6 @@ def parse_arguments(argv, config): parser.add_argument("-d", "--debug", action="store_true", help="show debug logs") parser.add_argument("--live", action="store_true", help="enable code live reload") - return parser.parse_args(argv) diff --git a/gns3server/modules/iou/iou_vm.py b/gns3server/modules/iou/iou_vm.py index 8beb127c..11481c7a 100644 --- a/gns3server/modules/iou/iou_vm.py +++ b/gns3server/modules/iou/iou_vm.py @@ -193,7 +193,6 @@ class IOUVM(BaseVM): "vm_id": self.id, "console": self._console, "project_id": self.project.id, - "iourc_path": self._iourc_path, "path": self.path } @@ -268,7 +267,7 @@ class IOUVM(BaseVM): # TODO: ASYNC # self._library_check() - if not self._iourc_path or not os.path.isfile(self._iourc_path): + if self._iourc_path and not os.path.isfile(self._iourc_path): raise IOUError("A valid iourc file is necessary to start IOU") iouyap_path = self.iouyap_path @@ -278,7 +277,8 @@ class IOUVM(BaseVM): self._create_netmap_config() # created a environment variable pointing to the iourc file. env = os.environ.copy() - env["IOURC"] = self._iourc_path + if self._iourc_path: + env["IOURC"] = self._iourc_path self._command = self._build_command() try: log.info("Starting IOU: {}".format(self._command)) diff --git a/gns3server/schemas/iou.py b/gns3server/schemas/iou.py index 5c3434b6..bc4f1ad4 100644 --- a/gns3server/schemas/iou.py +++ b/gns3server/schemas/iou.py @@ -52,7 +52,7 @@ IOU_CREATE_SCHEMA = { }, }, "additionalProperties": False, - "required": ["name", "path", "iourc_path"] + "required": ["name", "path"] } IOU_UPDATE_SCHEMA = { @@ -73,12 +73,24 @@ IOU_UPDATE_SCHEMA = { }, "path": { "description": "Path of iou binary", - "type": "string" + "type": ["string", "null"] }, "iourc_path": { "description": "Path of iourc", - "type": "string" + "type": ["string", "null"] }, + "initial_config": { + "description": "Initial configuration path", + "type": ["string", "null"] + }, + "serial_adapters": { + "description": "How many serial adapters are connected to the IOU", + "type": ["integer", "null"] + }, + "ethernet_adapters": { + "description": "How many ethernet adapters are connected to the IOU", + "type": ["integer", "null"] + } }, "additionalProperties": False, } @@ -117,11 +129,7 @@ IOU_OBJECT_SCHEMA = { "description": "Path of iou binary", "type": "string" }, - "iourc_path": { - "description": "Path of iourc", - "type": "string" - }, }, "additionalProperties": False, - "required": ["name", "vm_id", "console", "project_id", "path", "iourc_path"] + "required": ["name", "vm_id", "console", "project_id", "path"] }