Blame SOURCES/bz2072421-2-fence_zvmip-connect-error.patch

02ec8a
From 6430104318b4bf349425b08636183bf839812e04 Mon Sep 17 00:00:00 2001
02ec8a
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
02ec8a
Date: Tue, 31 May 2022 08:55:25 +0200
02ec8a
Subject: [PATCH] fence_zvmip: show unable to connect error instead of full
02ec8a
 stacktrace, e.g. when not using --ssl for SSL devices
02ec8a
02ec8a
---
02ec8a
 agents/zvm/fence_zvmip.py | 9 +++++++--
02ec8a
 1 file changed, 7 insertions(+), 2 deletions(-)
02ec8a
02ec8a
diff --git a/agents/zvm/fence_zvmip.py b/agents/zvm/fence_zvmip.py
02ec8a
index 90ca95d45..4f538e10d 100644
02ec8a
--- a/agents/zvm/fence_zvmip.py
02ec8a
+++ b/agents/zvm/fence_zvmip.py
02ec8a
@@ -127,8 +127,13 @@ def get_list_of_images(options, command, data_as_plug):
02ec8a
 
02ec8a
 	conn.send(packet)
02ec8a
 
02ec8a
-	request_id = struct.unpack("!i", conn.recv(INT4))[0]
02ec8a
-	(output_len, request_id, return_code, reason_code) = struct.unpack("!iiii", conn.recv(INT4 * 4))
02ec8a
+	try:
02ec8a
+		request_id = struct.unpack("!i", conn.recv(INT4))[0]
02ec8a
+		(output_len, request_id, return_code, reason_code) = struct.unpack("!iiii", conn.recv(INT4 * 4))
02ec8a
+	except struct.error:
02ec8a
+		logging.debug(sys.exc_info())
02ec8a
+		fail_usage("Failed: Unable to connect to {} port: {} SSL: {} \n".format(options["--ip"], options["--ipport"], bool("--ssl" in options)))
02ec8a
+
02ec8a
 	images = set()
02ec8a
 
02ec8a
 	if output_len > 3*INT4: