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

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