Blame SOURCES/bz2022334-fence_zvmip-add-disable-ssl.patch

cbc3ed
From 90c4f78e005ca4141039d1dce032b5f2c2ff4783 Mon Sep 17 00:00:00 2001
cbc3ed
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
cbc3ed
Date: Thu, 10 Feb 2022 12:22:58 +0100
cbc3ed
Subject: [PATCH 1/2] fencing: add ability to set bool parameters to 0 or false
cbc3ed
cbc3ed
---
cbc3ed
 lib/fencing.py.py | 2 ++
cbc3ed
 1 file changed, 2 insertions(+)
cbc3ed
cbc3ed
diff --git a/lib/fencing.py.py b/lib/fencing.py.py
cbc3ed
index 55e38c407..696388d55 100644
cbc3ed
--- a/lib/fencing.py.py
cbc3ed
+++ b/lib/fencing.py.py
cbc3ed
@@ -1502,6 +1502,8 @@ def _parse_input_stdin(avail_opt):
cbc3ed
 			opt["--"+all_opt[name]["longopt"].rstrip(":")] = value
cbc3ed
 		elif value.lower() in ["1", "yes", "on", "true"]:
cbc3ed
 			opt["--"+all_opt[name]["longopt"]] = "1"
cbc3ed
+		elif value.lower() in ["0", "no", "off", "false"]:
cbc3ed
+			opt["--"+all_opt[name]["longopt"]] = "0"
cbc3ed
 		else:
cbc3ed
 			logging.warning("Parse error: Ignoring option '%s' because it does not have value\n", name)
cbc3ed
 
cbc3ed
cbc3ed
From 249abc8e5620fb1a3d97a0af6db34b1f2cbf3ae5 Mon Sep 17 00:00:00 2001
cbc3ed
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
cbc3ed
Date: Thu, 10 Feb 2022 12:27:02 +0100
cbc3ed
Subject: [PATCH 2/2] fence_zvmip: add --disable-ssl
cbc3ed
cbc3ed
---
cbc3ed
 agents/zvm/fence_zvmip.py           | 18 +++++++++++++++++-
cbc3ed
 tests/data/metadata/fence_zvmip.xml |  7 ++++++-
cbc3ed
 2 files changed, 23 insertions(+), 2 deletions(-)
cbc3ed
cbc3ed
diff --git a/agents/zvm/fence_zvmip.py b/agents/zvm/fence_zvmip.py
cbc3ed
index 96021b13e..e8f849eda 100644
cbc3ed
--- a/agents/zvm/fence_zvmip.py
cbc3ed
+++ b/agents/zvm/fence_zvmip.py
cbc3ed
@@ -156,11 +156,24 @@ def get_list_of_images(options, command, data_as_plug):
cbc3ed
 	conn.close()
cbc3ed
 	return (return_code, reason_code, images)
cbc3ed
 
cbc3ed
+def define_new_opts():
cbc3ed
+	all_opt["disable_ssl"] = {
cbc3ed
+		"getopt" : "",
cbc3ed
+		"longopt" : "disable-ssl",
cbc3ed
+		"help" : "--disable-ssl                  Don't use SSL connection",
cbc3ed
+		"required" : "0",
cbc3ed
+		"shortdesc" : "Don't use SSL",
cbc3ed
+		"order": 2
cbc3ed
+	}
cbc3ed
+
cbc3ed
 def main():
cbc3ed
 	device_opt = ["ipaddr", "login", "passwd", "port", "method", "missing_as_off",
cbc3ed
-		      "inet4_only", "inet6_only", "ssl"]
cbc3ed
+		      "inet4_only", "inet6_only", "ssl", "disable_ssl"]
cbc3ed
 
cbc3ed
 	atexit.register(atexit_handler)
cbc3ed
+	define_new_opts()
cbc3ed
+
cbc3ed
+	all_opt["ssl"]["help"] = "-z, --ssl                      Use SSL connection with verifying certificate (Default)"
cbc3ed
 
cbc3ed
 	all_opt["ipport"]["default"] = "44444"
cbc3ed
 	all_opt["shell_timeout"]["default"] = "5"
cbc3ed
@@ -168,6 +181,9 @@ def main():
cbc3ed
 	all_opt["ssl"]["default"] = "1"
cbc3ed
 	options = check_input(device_opt, process_input(device_opt), other_conditions=True)
cbc3ed
 
cbc3ed
+	if "--disable-ssl" in options or options["--ssl"] == "0":
cbc3ed
+		del options["--ssl"]
cbc3ed
+
cbc3ed
 	if len(options.get("--plug", "")) > 8:
cbc3ed
 		fail_usage("Failed: Name of image can not be longer than 8 characters")
cbc3ed
 
cbc3ed
diff --git a/tests/data/metadata/fence_zvmip.xml b/tests/data/metadata/fence_zvmip.xml
cbc3ed
index f32fc159d..0b7ba4785 100644
cbc3ed
--- a/tests/data/metadata/fence_zvmip.xml
cbc3ed
+++ b/tests/data/metadata/fence_zvmip.xml
cbc3ed
@@ -94,7 +94,7 @@ to access the system's directory manager.
cbc3ed
 	<parameter name="ssl" unique="0" required="0">
cbc3ed
 		<getopt mixed="-z, --ssl" />
cbc3ed
 		<content type="boolean" default="1"  />
cbc3ed
-		<shortdesc lang="en">Use SSL connection with verifying certificate</shortdesc>
cbc3ed
+		<shortdesc lang="en">Use SSL connection with verifying certificate (Default)</shortdesc>
cbc3ed
 	</parameter>
cbc3ed
 	<parameter name="ssl_insecure" unique="0" required="0">
cbc3ed
 		<getopt mixed="--ssl-insecure" />
cbc3ed
@@ -111,6 +111,11 @@ to access the system's directory manager.
cbc3ed
 		<content type="string"  />
cbc3ed
 		<shortdesc lang="en">Login name</shortdesc>
cbc3ed
 	</parameter>
cbc3ed
+	<parameter name="disable_ssl" unique="0" required="0">
cbc3ed
+		<getopt mixed="--disable-ssl" />
cbc3ed
+		<content type="boolean"  />
cbc3ed
+		<shortdesc lang="en">Don't use SSL</shortdesc>
cbc3ed
+	</parameter>
cbc3ed
 	<parameter name="quiet" unique="0" required="0">
cbc3ed
 		<getopt mixed="-q, --quiet" />
cbc3ed
 		<content type="boolean"  />