Blame SOURCES/bz2160478-fence_scsi-fix-validate-all.patch

0af936
From a416a367a804f1e5abaf142c629fe6ab5572d3b6 Mon Sep 17 00:00:00 2001
0af936
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
0af936
Date: Thu, 12 Jan 2023 15:46:41 +0100
0af936
Subject: [PATCH] fence_scsi: skip key generation during validate-all action
0af936
0af936
---
0af936
 agents/scsi/fence_scsi.py | 9 +++++----
0af936
 1 file changed, 5 insertions(+), 4 deletions(-)
0af936
0af936
diff --git a/agents/scsi/fence_scsi.py b/agents/scsi/fence_scsi.py
0af936
index e33339614..f9e6823b2 100644
0af936
--- a/agents/scsi/fence_scsi.py
0af936
+++ b/agents/scsi/fence_scsi.py
0af936
@@ -566,11 +566,12 @@ def main():
0af936
 	or ("--key" in options and options["--key"])):
0af936
 		fail_usage("Failed: nodename or key is required", stop_after_error)
0af936
 
0af936
-	if not ("--key" in options and options["--key"]):
0af936
-		options["--key"] = generate_key(options)
0af936
+	if options["--action"] != "validate-all":
0af936
+		if not ("--key" in options and options["--key"]):
0af936
+			options["--key"] = generate_key(options)
0af936
 
0af936
-	if options["--key"] == "0" or not options["--key"]:
0af936
-		fail_usage("Failed: key cannot be 0", stop_after_error)
0af936
+		if options["--key"] == "0" or not options["--key"]:
0af936
+			fail_usage("Failed: key cannot be 0", stop_after_error)
0af936
 
0af936
 	if "--key-value" in options\
0af936
 	and (options["--key-value"] != "id" and options["--key-value"] != "hash"):