Blame SOURCES/bz1753229-fence_mpath-2-fix-plug-parameter-issues.patch

2d8bb4
From 868c494d17952eecc6736683c6df04aa9d3a3199 Mon Sep 17 00:00:00 2001
2d8bb4
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
2d8bb4
Date: Fri, 20 Sep 2019 12:06:55 +0200
2d8bb4
Subject: [PATCH] fence_mpath: fix fail_usage() issue and a couple of other
2d8bb4
 minor issues w/the newly added plug/port parameter
2d8bb4
2d8bb4
---
2d8bb4
 agents/mpath/fence_mpath.py         | 12 +++++++-----
2d8bb4
 tests/data/metadata/fence_mpath.xml | 10 +++++-----
2d8bb4
 2 files changed, 12 insertions(+), 10 deletions(-)
2d8bb4
2d8bb4
diff --git a/agents/mpath/fence_mpath.py b/agents/mpath/fence_mpath.py
2d8bb4
index 25aeb052..73517851 100644
2d8bb4
--- a/agents/mpath/fence_mpath.py
2d8bb4
+++ b/agents/mpath/fence_mpath.py
2d8bb4
@@ -213,7 +213,7 @@ def define_new_opts():
2d8bb4
 		"longopt" : "key",
2d8bb4
 		"help" : "-k, --key=[key]                Replaced by -n, --plug",
2d8bb4
 		"required" : "0",
2d8bb4
-		"shortdesc" : "Replaced by -n, --plug",
2d8bb4
+		"shortdesc" : "Replaced by port/-n/--plug",
2d8bb4
 		"order": 1
2d8bb4
 	}
2d8bb4
 	all_opt["mpathpersist_path"] = {
2d8bb4
@@ -244,7 +244,8 @@ def main():
2d8bb4
 
2d8bb4
 	define_new_opts()
2d8bb4
 
2d8bb4
-	all_opt["port"]["help"] = "Key to use for the current operation"
2d8bb4
+	all_opt["port"]["required"] = "0"
2d8bb4
+	all_opt["port"]["help"] = "-n, --plug=[key]               Key to use for the current operation"
2d8bb4
 	all_opt["port"]["shortdesc"] = "Key to use for the current operation. \
2d8bb4
 This key should be unique to a node and have to be written in \
2d8bb4
 /etc/multipath.conf. For the \"on\" action, the key specifies the key use to \
2d8bb4
@@ -266,9 +267,10 @@ def main():
2d8bb4
 	if "--key" in options:
2d8bb4
 		options["--plug"] = options["--key"]
2d8bb4
 		del options["--key"]
2d8bb4
-	elif options["--action"] in ["off", "on", "reboot", "status"] \
2d8bb4
-	     and "--plug" not in options:
2d8bb4
-		fail_usage("Failed: You have to enter plug number or machine identification", stop)
2d8bb4
+	elif "--help" not in options and options["--action"] in ["off", "on", \
2d8bb4
+	     "reboot", "status", "validate-all"] and "--plug" not in options:
2d8bb4
+		stop_after_error = False if options["--action"] == "validate-all" else True
2d8bb4
+		fail_usage("Failed: You have to enter plug number or machine identification", stop_after_error)
2d8bb4
 
2d8bb4
 	docs = {}
2d8bb4
 	docs["shortdesc"] = "Fence agent for multipath persistent reservation"
2d8bb4
diff --git a/tests/data/metadata/fence_mpath.xml b/tests/data/metadata/fence_mpath.xml
2d8bb4
index fe9378df..f5e60823 100644
2d8bb4
--- a/tests/data/metadata/fence_mpath.xml
2d8bb4
+++ b/tests/data/metadata/fence_mpath.xml
2d8bb4
@@ -17,15 +17,15 @@ The fence_mpath agent works by having a unique key for each node that has to be
2d8bb4
 	<parameter name="key" unique="0" required="0">
2d8bb4
 		<getopt mixed="-k, --key=[key]" />
2d8bb4
 		<content type="string"  />
2d8bb4
-		<shortdesc lang="en">Replaced by -n, --plug</shortdesc>
2d8bb4
+		<shortdesc lang="en">Replaced by port/-n/--plug</shortdesc>
2d8bb4
 	</parameter>
2d8bb4
-	<parameter name="plug" unique="0" required="1" obsoletes="port">
2d8bb4
-		<getopt mixed="Key to use for the current operation" />
2d8bb4
+	<parameter name="plug" unique="0" required="0" obsoletes="port">
2d8bb4
+		<getopt mixed="-n, --plug=[key]" />
2d8bb4
 		<content type="string"  />
2d8bb4
 		<shortdesc lang="en">Key to use for the current operation. This key should be unique to a node and have to be written in /etc/multipath.conf. For the "on" action, the key specifies the key use to register the local node. For the "off" action, this key specifies the key to be removed from the device(s).</shortdesc>
2d8bb4
 	</parameter>
2d8bb4
-	<parameter name="port" unique="0" required="1" deprecated="1">
2d8bb4
-		<getopt mixed="Key to use for the current operation" />
2d8bb4
+	<parameter name="port" unique="0" required="0" deprecated="1">
2d8bb4
+		<getopt mixed="-n, --plug=[key]" />
2d8bb4
 		<content type="string"  />
2d8bb4
 		<shortdesc lang="en">Key to use for the current operation. This key should be unique to a node and have to be written in /etc/multipath.conf. For the "on" action, the key specifies the key use to register the local node. For the "off" action, this key specifies the key to be removed from the device(s).</shortdesc>
2d8bb4
 	</parameter>