From 11fcb6c0f3d47080eb3192584fab4715cbaaf986 Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 19 May 2020 14:47:21 +0300 Subject: [PATCH] show socket error & check with is True --- computes/views.py | 2 +- vrtManager/connection.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/computes/views.py b/computes/views.py index b78ee44..d96f439 100644 --- a/computes/views.py +++ b/computes/views.py @@ -86,7 +86,7 @@ def overview(request, compute_id): error_messages = [] compute = get_object_or_404(Compute, pk=compute_id) - status = 'true' if connection_manager.host_is_up(compute.type, compute.hostname) else 'false' + status = 'true' if connection_manager.host_is_up(compute.type, compute.hostname) is True else 'false' try: conn = wvmHostDetails( diff --git a/vrtManager/connection.py b/vrtManager/connection.py index 3572765..0a7c5bc 100644 --- a/vrtManager/connection.py +++ b/vrtManager/connection.py @@ -326,8 +326,8 @@ class wvmConnectionManager(object): socket_host.connect('/var/run/libvirt/libvirt-sock') socket_host.close() return True - except Exception: - return False + except Exception as err: + return err connection_manager = wvmConnectionManager(