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

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