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

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