diff --git a/SOURCES/bz2003189-fence_aws-add-filter-parameter.patch b/SOURCES/bz2003189-fence_aws-add-filter-parameter.patch new file mode 100644 index 0000000..5fa7a3d --- /dev/null +++ b/SOURCES/bz2003189-fence_aws-add-filter-parameter.patch @@ -0,0 +1,74 @@ +From d920421ccb3abb42ecb9ea3ba56948db00fe1c80 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Tue, 23 Mar 2021 12:14:11 +0100 +Subject: [PATCH] fence_aws: add filter parameter to be able to limit which + nodes are listed + +--- + agents/aws/fence_aws.py | 27 +++++++++++++++++++++------ + tests/data/metadata/fence_aws.xml | 5 +++++ + 2 files changed, 26 insertions(+), 6 deletions(-) + +diff --git a/agents/aws/fence_aws.py b/agents/aws/fence_aws.py +index 8322df9ed..c947bf29c 100644 +--- a/agents/aws/fence_aws.py ++++ b/agents/aws/fence_aws.py +@@ -38,8 +38,15 @@ def get_nodes_list(conn, options): + logger.info("Starting monitor operation") + result = {} + try: +- for instance in conn.instances.all(): +- result[instance.id] = ("", None) ++ if "--filter" in options: ++ filter_key = options["--filter"].split("=")[0].strip() ++ filter_value = options["--filter"].split("=")[1].strip() ++ filter = [{ "Name": filter_key, "Values": [filter_value] }] ++ for instance in conn.instances.filter(Filters=filter): ++ result[instance.id] = ("", None) ++ else: ++ for instance in conn.instances.all(): ++ result[instance.id] = ("", None) + except ClientError: + fail_usage("Failed: Incorrect Access Key or Secret Key.") + except EndpointConnectionError: +@@ -111,7 +118,7 @@ def define_new_opts(): + all_opt["region"] = { + "getopt" : "r:", + "longopt" : "region", +- "help" : "-r, --region=[region] Region, e.g. us-east-1", ++ "help" : "-r, --region=[region] Region, e.g. us-east-1", + "shortdesc" : "Region.", + "required" : "0", + "order" : 2 +@@ -132,21 +139,29 @@ def define_new_opts(): + "required" : "0", + "order" : 4 + } ++ all_opt["filter"] = { ++ "getopt" : ":", ++ "longopt" : "filter", ++ "help" : "--filter=[key=value] Filter (e.g. vpc-id=[vpc-XXYYZZAA]", ++ "shortdesc": "Filter for list-action", ++ "required": "0", ++ "order": 5 ++ } + all_opt["boto3_debug"] = { + "getopt" : "b:", + "longopt" : "boto3_debug", +- "help" : "-b, --boto3_debug=[option] Boto3 and Botocore library debug logging", ++ "help" : "-b, --boto3_debug=[option] Boto3 and Botocore library debug logging", + "shortdesc": "Boto Lib debug", + "required": "0", + "default": "False", +- "order": 5 ++ "order": 6 + } + + # Main agent method + def main(): + conn = None + +- device_opt = ["port", "no_password", "region", "access_key", "secret_key", "boto3_debug"] ++ device_opt = ["port", "no_password", "region", "access_key", "secret_key", "filter", "boto3_debug"] + + atexit.register(atexit_handler) diff --git a/SPECS/fence-agents.spec b/SPECS/fence-agents.spec index 12bc8da..7313194 100644 --- a/SPECS/fence-agents.spec +++ b/SPECS/fence-agents.spec @@ -67,7 +67,7 @@ Name: fence-agents Summary: Fence Agents for Red Hat Cluster Version: 4.2.1 -Release: 41%{?alphatag:.%{alphatag}}%{?dist}.4 +Release: 41%{?alphatag:.%{alphatag}}%{?dist}.5 License: GPLv2+ and LGPLv2+ Group: System Environment/Base URL: https://github.com/ClusterLabs/fence-agents @@ -139,13 +139,15 @@ Patch64: bz1860545-fence_lpar-fix-long-user-host-issue.patch Patch65: bz1862024-fence_evacuate-support-private-flavors.patch Patch66: bz1905735-fence_aws-add-imdsv2-support.patch Patch67: bz1957762-fence_azure_arm-fix-MSI-support.patch +Patch68: bz2003189-fence_aws-add-filter-parameter.patch + # bundle patches Patch1000: bz1568753-4-fence_gce-bundled-libs.patch Patch1001: bz1568753-5-%{oauth2client}-docs-build-fix.patch Patch1002: bz1568753-6-%{oauth2client}-python-rsa-to-cryptography.patch Patch1003: bz1568753-7-%{keyring}-fix-gnome-version-warning.patch -%if 0%{?rhel} +%if 0%{?fedora} || 0%{?rhel} %global supportedagents amt_ws apc apc_snmp bladecenter brocade cisco_mds cisco_ucs compute drac5 eaton_snmp emerson eps evacuate hpblade ibmblade ifmib ilo ilo_moonshot ilo_mp ilo_ssh intelmodular ipdu ipmilan lpar mpath kdump redfish rhevm rsa rsb sbd scsi vmware_rest vmware_soap wti %ifarch x86_64 %global testagents virsh heuristics_ping aliyun aws azure_arm gce @@ -239,6 +241,7 @@ BuildRequires: python-six >= 1.6.1 %patch65 -p1 %patch66 -p1 %patch67 -p1 +%patch68 -p1 # prevent compilation of something that won't get used anyway sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac @@ -1190,6 +1193,10 @@ The fence-agents-zvm package contains a fence agent for z/VM hypervisors %endif %changelog +* Tue Oct 19 2021 Oyvind Albrigtsen - 4.2.1-41.5 +- fence_aws: add "filter" parameter + Resolves: rhbz#2003189 + * Wed May 12 2021 Oyvind Albrigtsen - 4.2.1-41.4 - fence_azure_arm: fix MSI support Resolves: rhbz#1957762