From 211f48d9818e25dfb7f4dcba0f893ccd6557ef5b Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 3 Aug 2017 16:31:28 +0200 Subject: [PATCH] Catch error when something that is not the GNS3 server answer to virtualbox requests Fix #1155 --- gns3server/controller/gns3vm/virtualbox_gns3_vm.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gns3server/controller/gns3vm/virtualbox_gns3_vm.py b/gns3server/controller/gns3vm/virtualbox_gns3_vm.py index 96b8c027..189b40c5 100644 --- a/gns3server/controller/gns3vm/virtualbox_gns3_vm.py +++ b/gns3server/controller/gns3vm/virtualbox_gns3_vm.py @@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import json.decoder import aiohttp import logging import asyncio @@ -232,10 +231,11 @@ class VirtualBoxGNS3VM(BaseGNS3VM): pass if resp: - try: - json_data = yield from resp.json() - except ValueError: - pass + if resp.status < 300: + try: + json_data = yield from resp.json() + except ValueError: + pass resp.close() session.close()