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

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