From 84b12fd9537efaec465ac6c9ca74d22966212a2f Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 26 May 2016 10:11:11 +0200 Subject: [PATCH] Support null in compute user and password --- gns3server/controller/compute.py | 12 +++++++----- gns3server/schemas/compute.py | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gns3server/controller/compute.py b/gns3server/controller/compute.py index 6d0b1b75..da9fb86b 100644 --- a/gns3server/controller/compute.py +++ b/gns3server/controller/compute.py @@ -72,12 +72,14 @@ class Compute: """ Set authentication parameters """ - self._user = user - self._password = password - if self._user and self._password: - self._auth = aiohttp.BasicAuth(self._user, self._password) - else: + if user is None or len(user.strip()) == 0: + self._user = None + self._password = None self._auth = None + else: + self._user = user.strip() + self._password = password.strip() + self._auth = aiohttp.BasicAuth(self._user, self._password) @asyncio.coroutine def update(self, **kwargs): diff --git a/gns3server/schemas/compute.py b/gns3server/schemas/compute.py index 910d1fd9..8eb45e37 100644 --- a/gns3server/schemas/compute.py +++ b/gns3server/schemas/compute.py @@ -43,11 +43,11 @@ COMPUTE_CREATE_SCHEMA = { }, "user": { "description": "User for authentication", - "type": "string" + "type": ["string", "null"] }, "password": { "description": "Password for authentication", - "type": "string" + "type": ["string", "null"] } }, "additionalProperties": False, @@ -84,7 +84,7 @@ COMPUTE_OBJECT_SCHEMA = { }, "user": { "description": "User for authentication", - "type": "string" + "type": ["string", "null"] }, "connected": { "description": "Whether the controller is connected to the compute server or not",