From 853bff1d9e038579c3eb26c274671cc6f79560f8 Mon Sep 17 00:00:00 2001 From: David Weinholz Date: Mon, 22 Feb 2021 13:42:40 +0100 Subject: [PATCH] delete backend catch exception --- VirtualMachineService/VirtualMachineHandler.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index d5e8743a..6d90b0e9 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -40,14 +40,14 @@ import datetime import json import logging -from distutils.version import LooseVersion +import os import parser import socket import time import urllib from contextlib import closing +from distutils.version import LooseVersion -import os import redis import requests as req import yaml @@ -1440,7 +1440,10 @@ def delete_backend(self, id): verify=True, ) if response.status_code != 200: - return str(response.json()) + try: + return str(response.json()) + except json.JSONDecodeError: + return response.content elif response.status_code == 200: return str(True) except Timeout as e: