PEP8, documentation update, test fix

This commit is contained in:
Julien Duponchelle 2015-01-26 09:36:26 +01:00
parent 50fea669b5
commit 70faf76c10
20 changed files with 69 additions and 54 deletions

View File

@ -13,10 +13,10 @@ SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /vpcs/{uuid} X-ROUTE: /vpcs/{uuid}
{ {
"console": 2001, "console": 2003,
"name": "PC TEST 1", "name": "PC TEST 1",
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
"script_file": null, "script_file": null,
"startup_script": null, "startup_script": null,
"uuid": "b37ef237-15aa-46a7-bdc5-8fa8657056c6" "uuid": "624e94fb-9e7e-45d0-a27d-4eeda19e98cd"
} }

View File

@ -11,7 +11,7 @@ POST /virtualbox HTTP/1.1
HTTP/1.1 201 HTTP/1.1 201
CONNECTION: close CONNECTION: close
CONTENT-LENGTH: 348 CONTENT-LENGTH: 369
CONTENT-TYPE: application/json CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.4 aiohttp/0.13.1 SERVER: Python/3.4 aiohttp/0.13.1
@ -21,11 +21,12 @@ X-ROUTE: /virtualbox
"adapter_start_index": 0, "adapter_start_index": 0,
"adapter_type": "Intel PRO/1000 MT Desktop (82540EM)", "adapter_type": "Intel PRO/1000 MT Desktop (82540EM)",
"adapters": 0, "adapters": 0,
"console": 2000,
"enable_remote_console": false, "enable_remote_console": false,
"headless": false, "headless": false,
"linked_clone": false, "linked_clone": false,
"name": "VM1", "name": "VM1",
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
"uuid": "767b6b21-2209-4d73-aec8-49e4a332709d", "uuid": "bd6e0124-bb4b-4224-a71f-9a28c302df4e",
"vmname": "VM1" "vmname": "VM1"
} }

View File

@ -16,10 +16,10 @@ SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /vpcs X-ROUTE: /vpcs
{ {
"console": 2000, "console": 2001,
"name": "PC TEST 1", "name": "PC TEST 1",
"project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80", "project_uuid": "a1e920ca-338a-4e9f-b363-aa607b09dd80",
"script_file": null, "script_file": null,
"startup_script": null, "startup_script": null,
"uuid": "076902d4-97d2-4243-b4fb-374a381d4bc5" "uuid": "fc2b4d10-e4c6-4545-8b59-cd7a09bc3d33"
} }

View File

@ -15,7 +15,7 @@ SERVER: Python/3.4 aiohttp/0.13.1
X-ROUTE: /project/{uuid} X-ROUTE: /project/{uuid}
{ {
"location": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmps4qnfnar", "location": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmp2d1dq1sb",
"temporary": false, "temporary": false,
"uuid": "b3eccaca-af01-4244-a3fd-da1fb98d04c9" "uuid": "7a6d9fd4-c212-4368-950f-5513e518313a"
} }

View File

@ -5,7 +5,7 @@
GET /project/**{uuid}** GET /project/**{uuid}**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get project informations Get project information
Parameters Parameters
********** **********

View File

@ -10,7 +10,7 @@ Create a new VirtualBox VM instance
Response status codes Response status codes
********************** **********************
- **400**: Invalid project UUID - **400**: Invalid project UUID
- **201**: VirtualBox VM instance created - **201**: Instance created
- **409**: Conflict - **409**: Conflict
Input Input
@ -19,6 +19,7 @@ Input
<table> <table>
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr> <tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
<tr><td>console</td> <td> </td> <td>integer</td> <td>console TCP port</td> </tr>
<tr><td>linked_clone</td> <td>&#10004;</td> <td>boolean</td> <td>either the VM is a linked clone or not</td> </tr> <tr><td>linked_clone</td> <td>&#10004;</td> <td>boolean</td> <td>either the VM is a linked clone or not</td> </tr>
<tr><td>name</td> <td>&#10004;</td> <td>string</td> <td>VirtualBox VM instance name</td> </tr> <tr><td>name</td> <td>&#10004;</td> <td>string</td> <td>VirtualBox VM instance name</td> </tr>
<tr><td>project_uuid</td> <td>&#10004;</td> <td>string</td> <td>Project UUID</td> </tr> <tr><td>project_uuid</td> <td>&#10004;</td> <td>string</td> <td>Project UUID</td> </tr>

View File

@ -9,11 +9,11 @@ Reload a VirtualBox VM instance
Parameters Parameters
********** **********
- **uuid**: VirtualBox VM instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **400**: Invalid VirtualBox VM instance UUID - **400**: Invalid instance UUID
- **404**: VirtualBox VM instance doesn't exist - **404**: Instance doesn't exist
- **204**: VirtualBox VM instance reloaded - **204**: Instance reloaded

View File

@ -9,11 +9,11 @@ Resume a suspended VirtualBox VM instance
Parameters Parameters
********** **********
- **uuid**: VirtualBox VM instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **400**: Invalid VirtualBox VM instance UUID - **400**: Invalid instance UUID
- **404**: VirtualBox VM instance doesn't exist - **404**: Instance doesn't exist
- **204**: VirtualBox VM instance resumed - **204**: Instance resumed

View File

@ -9,13 +9,13 @@ Start a VirtualBox VM instance
Parameters Parameters
********** **********
- **uuid**: VirtualBox VM instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **400**: Invalid VirtualBox VM instance UUID - **400**: Invalid instance UUID
- **404**: VirtualBox VM instance doesn't exist - **404**: Instance doesn't exist
- **204**: VirtualBox VM instance started - **204**: Instance started
Sample session Sample session
*************** ***************

View File

@ -9,13 +9,13 @@ Stop a VirtualBox VM instance
Parameters Parameters
********** **********
- **uuid**: VirtualBox VM instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **400**: Invalid VirtualBox VM instance UUID - **400**: Invalid instance UUID
- **404**: VirtualBox VM instance doesn't exist - **404**: Instance doesn't exist
- **204**: VirtualBox VM instance stopped - **204**: Instance stopped
Sample session Sample session
*************** ***************

View File

@ -9,11 +9,11 @@ Suspend a VirtualBox VM instance
Parameters Parameters
********** **********
- **uuid**: VirtualBox VM instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **400**: Invalid VirtualBox VM instance UUID - **400**: Invalid instance UUID
- **404**: VirtualBox VM instance doesn't exist - **404**: Instance doesn't exist
- **204**: VirtualBox VM instance suspended - **204**: Instance suspended

View File

@ -10,7 +10,7 @@ Create a new VPCS instance
Response status codes Response status codes
********************** **********************
- **400**: Invalid project UUID - **400**: Invalid project UUID
- **201**: VPCS instance created - **201**: Instance created
- **409**: Conflict - **409**: Conflict
Input Input

View File

@ -9,12 +9,26 @@ Get a VPCS instance
Parameters Parameters
********** **********
- **uuid**: VPCS instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **200**: Success - **200**: Success
- **404**: VPCS instance doesn't exist - **404**: Instance doesn't exist
Output
*******
.. raw:: html
<table>
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
<tr><td>console</td> <td>&#10004;</td> <td>integer</td> <td>console TCP port</td> </tr>
<tr><td>name</td> <td>&#10004;</td> <td>string</td> <td>VPCS device name</td> </tr>
<tr><td>project_uuid</td> <td>&#10004;</td> <td>string</td> <td>Project UUID</td> </tr>
<tr><td>script_file</td> <td> </td> <td>['string', 'null']</td> <td>VPCS startup script</td> </tr>
<tr><td>startup_script</td> <td> </td> <td>['string', 'null']</td> <td>Content of the VPCS startup script</td> </tr>
<tr><td>uuid</td> <td>&#10004;</td> <td>string</td> <td>VPCS device UUID</td> </tr>
</table>
Sample session Sample session
*************** ***************
@ -29,13 +43,13 @@ Update a VPCS instance
Parameters Parameters
********** **********
- **uuid**: VPCS instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **200**: VPCS instance updated - **200**: Instance updated
- **409**: Conflict - **409**: Conflict
- **404**: VPCS instance doesn't exist - **404**: Instance doesn't exist
Input Input
******* *******
@ -70,10 +84,10 @@ Delete a VPCS instance
Parameters Parameters
********** **********
- **uuid**: VPCS instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **404**: VPCS instance doesn't exist - **404**: Instance doesn't exist
- **204**: VPCS instance deleted - **204**: Instance deleted

View File

@ -5,15 +5,15 @@
POST /vpcs/**{uuid}**/reload POST /vpcs/**{uuid}**/reload
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remove a NIO from a VPCS Reload a VPCS instance
Parameters Parameters
********** **********
- **uuid**: VPCS instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **400**: Invalid VPCS instance UUID - **400**: Invalid instance UUID
- **404**: VPCS instance doesn't exist - **404**: Instance doesn't exist
- **204**: VPCS reloaded - **204**: Instance reloaded

View File

@ -9,11 +9,11 @@ Start a VPCS instance
Parameters Parameters
********** **********
- **uuid**: VPCS instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **400**: Invalid VPCS instance UUID - **400**: Invalid VPCS instance UUID
- **404**: VPCS instance doesn't exist - **404**: Instance doesn't exist
- **204**: VPCS instance started - **204**: Instance started

View File

@ -9,11 +9,11 @@ Stop a VPCS instance
Parameters Parameters
********** **********
- **uuid**: VPCS instance UUID - **uuid**: Instance UUID
Response status codes Response status codes
********************** **********************
- **400**: Invalid VPCS instance UUID - **400**: Invalid VPCS instance UUID
- **404**: VPCS instance doesn't exist - **404**: Instance doesn't exist
- **204**: VPCS instance stopped - **204**: Instance stopped

View File

@ -51,7 +51,6 @@ class PortManager:
else: else:
self._console_host = host self._console_host = host
assert not hasattr(PortManager, "_instance")
PortManager._instance = self PortManager._instance = self
@classmethod @classmethod

View File

@ -428,7 +428,7 @@ class VirtualBoxVM(BaseVM):
log.info("VirtualBox VM '{name}' [{uuid}] has set the VM name to '{vmname}'".format(name=self.name, uuid=self.uuid, vmname=vmname)) log.info("VirtualBox VM '{name}' [{uuid}] has set the VM name to '{vmname}'".format(name=self.name, uuid=self.uuid, vmname=vmname))
# TODO: test linked clone # TODO: test linked clone
#if self._linked_clone: # if self._linked_clone:
# yield from self._modify_vm('--name "{}"'.format(vmname)) # yield from self._modify_vm('--name "{}"'.format(vmname))
self._vmname = vmname self._vmname = vmname

View File

@ -89,7 +89,7 @@ def interfaces():
import netifaces import netifaces
for interface in netifaces.interfaces(): for interface in netifaces.interfaces():
results.append({"id": interface, results.append({"id": interface,
"name": interface}) "name": interface})
except ImportError: except ImportError:
return return
else: else: