From 0c72ccd06640c12b30e121555d18e5c88e8f9219 Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 19 May 2020 00:07:46 +0300 Subject: [PATCH] add localhost is up checking --- vrtManager/connection.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vrtManager/connection.py b/vrtManager/connection.py index 3acd715..3572765 100644 --- a/vrtManager/connection.py +++ b/vrtManager/connection.py @@ -321,10 +321,13 @@ class wvmConnectionManager(object): socket_host.connect((hostname, TCP_PORT)) if conn_type == CONN_TLS: socket_host.connect((hostname, TLS_PORT)) + if conn_type == CONN_SOCKET: + socket_host = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + socket_host.connect('/var/run/libvirt/libvirt-sock') socket_host.close() return True - except Exception as err: - return err + except Exception: + return False connection_manager = wvmConnectionManager(