From dbbcc001f1beb29a2aae70fedf31c81e173c98b9 Mon Sep 17 00:00:00 2001 From: wubijie Date: Tue, 22 Aug 2023 19:11:23 +0800 Subject: [PATCH] fence_openstack: fix fail_usage() issue and a couple of other minor issues w/the newly added plug/port parameter (cherry picked from commit 82bc2a48bb36f50ced3e6d2cebad1355ccd42f83) --- 0001-fix-fail_usage-issue.patch | 77 +++++++++++++++++++++++++++++++++ fence-agents.spec | 8 +++- 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 0001-fix-fail_usage-issue.patch diff --git a/0001-fix-fail_usage-issue.patch b/0001-fix-fail_usage-issue.patch new file mode 100644 index 0000000..f72d380 --- /dev/null +++ b/0001-fix-fail_usage-issue.patch @@ -0,0 +1,77 @@ +From ed3ce39ac322edc0c764c8347aab79efcd6785ce Mon Sep 17 00:00:00 2001 +From: wubijie +Date: Tue, 22 Aug 2023 19:08:34 +0800 +Subject: [PATCH] fix fail_usage() issue + +--- + agents/openstack/fence_openstack.py | 11 ++++++----- + tests/data/metadata/fence_openstack.xml | 6 +++--- + 2 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/agents/openstack/fence_openstack.py b/agents/openstack/fence_openstack.py +index 5257ec5..1a1218c 100755 +--- a/agents/openstack/fence_openstack.py ++++ b/agents/openstack/fence_openstack.py +@@ -114,7 +114,7 @@ def define_new_opts(): + "longopt" : "uuid", + "help" : "--uuid=[uuid] Replaced by -n, --plug", + "required" : "0", +- "shortdesc" : "Replaced by port", ++ "shortdesc" : "Replaced by port/-n/--plug", + "order": 1 + } + +@@ -126,6 +126,7 @@ def main(): + "port", "no_port", "uuid" ] + define_new_opts() + ++ all_opt["port"]["required"] = "0" + all_opt["port"]["help"] = "-n, --plug=[UUID] UUID of the node to be fenced" + all_opt["port"]["shortdesc"] = "UUID of the node to be fenced." + +@@ -138,10 +139,10 @@ def main(): + if "--uuid" in options: + options["--plug"] = options["--uuid"] + del options["--uuid"] +- elif options["--action"] in ["off", "on", "reboot", "status"] \ +- and "--plug" not in options: +- fail_usage("Failed: You have to enter plug number or machine identification", stop) +- ++ elif "--help" not in options and options["--action"] in ["off", "on", \ ++ "reboot", "status", "validate-all"] and "--plug" not in options: ++ stop_after_error = False if options["--action"] == "validate-all" else True ++ fail_usage("Failed: You have to enter plug number or machine identification", stop_after_error) + docs = {} + docs["shortdesc"] = "Fence agent for OpenStack's Nova service" + docs["longdesc"] = "fence_openstack is a Fencing agent \ +diff --git a/tests/data/metadata/fence_openstack.xml b/tests/data/metadata/fence_openstack.xml +index a7b2594..3a799f4 100644 +--- a/tests/data/metadata/fence_openstack.xml ++++ b/tests/data/metadata/fence_openstack.xml +@@ -43,12 +43,12 @@ + + Script to run to retrieve password + +- ++ + + + UUID of the node to be fenced. + +- ++ + + + UUID of the node to be fenced. +@@ -91,7 +91,7 @@ + + + +- Replaced by port ++ Replaced by port/-n/--plig + + + +-- +2.33.0 + diff --git a/fence-agents.spec b/fence-agents.spec index 5d2fee7..edb3c27 100644 --- a/fence-agents.spec +++ b/fence-agents.spec @@ -6,14 +6,14 @@ Name: fence-agents Summary: Set of unified programs capable of host isolation ("fencing") Version: 4.5.0 -Release: 2 +Release: 3 License: GPLv2+ and LGPLv2+ Group: System Environment/Base URL: https://github.com/ClusterLabs/fence-agents Source0: https://github.com/ClusterLabs/fence-agents/archive/v4.5.0.tar.gz Patch0: fix-fail_usage-issue-and-a-couple-of-other-minor-iss.patch - +Patch1: 0001-fix-fail_usage-issue.patch %global allfenceagents %(cat < - 4.5.0-3 +- fence_openstack: fix fail_usage() issue and a couple of other minor issues w/the newly added plug/port parameter + * Wed Aug 23 2023 zhanghan - 4.5.0-2 - fix fail_usage() issue and a couple of other minor issues w/the newly added plug/port parameter -- Gitee