- fence_ibm_vpc: add apikey file support
Resolves: RHEL-107504
This commit is contained in:
parent
41ba81d0ef
commit
32e3bbf79b
50
RHEL-107504-fence_ibm_vpc-add-apikey-file-support.patch
Normal file
50
RHEL-107504-fence_ibm_vpc-add-apikey-file-support.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 9460728b18c648e390390d888ac856628366a521 Mon Sep 17 00:00:00 2001
|
||||
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||
Date: Thu, 7 Aug 2025 14:53:30 +0200
|
||||
Subject: [PATCH] fence_ibm_vpc: add apikey file support
|
||||
|
||||
---
|
||||
agents/ibm_vpc/fence_ibm_vpc.py | 23 ++++++++++++++++++++++-
|
||||
1 file changed, 22 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/agents/ibm_vpc/fence_ibm_vpc.py b/agents/ibm_vpc/fence_ibm_vpc.py
|
||||
index efda5eed7..a87e9e6dc 100755
|
||||
--- a/agents/ibm_vpc/fence_ibm_vpc.py
|
||||
+++ b/agents/ibm_vpc/fence_ibm_vpc.py
|
||||
@@ -7,7 +7,7 @@
|
||||
import hashlib
|
||||
sys.path.append("@FENCEAGENTSLIBDIR@")
|
||||
from fencing import *
|
||||
-from fencing import fail, run_delay, EC_LOGIN_DENIED, EC_STATUS, EC_GENERIC_ERROR
|
||||
+from fencing import fail, run_delay, EC_BAD_ARGS, EC_LOGIN_DENIED, EC_STATUS, EC_GENERIC_ERROR
|
||||
|
||||
state = {
|
||||
"running": "on",
|
||||
@@ -315,6 +315,27 @@ def main():
|
||||
####
|
||||
run_delay(options)
|
||||
|
||||
+ if options["--apikey"][0] == '@':
|
||||
+ key_file = options["--apikey"][1:]
|
||||
+ try:
|
||||
+ # read the API key from a file
|
||||
+ with open(key_file, "r") as f:
|
||||
+ try:
|
||||
+ keys = json.loads(f.read())
|
||||
+ # data seems to be in json format
|
||||
+ # return the value of the item with the key 'Apikey'
|
||||
+ options["--apikey"] = keys.get("Apikey", "")
|
||||
+ if not options["--apikey"]:
|
||||
+ # backward compatibility: former key name was 'apikey'
|
||||
+ options["--apikey"] = keys.get("apikey", "")
|
||||
+ # data is text, return as is
|
||||
+ except ValueError:
|
||||
+ f.seek(0)
|
||||
+ options["--apikey"] = f.read().strip()
|
||||
+ except FileNotFoundError:
|
||||
+ logging.error("Failed: Cannot open file {}".format(key_file))
|
||||
+ sys.exit(EC_BAD_ARGS)
|
||||
+
|
||||
conn = connect(options)
|
||||
atexit.register(disconnect, conn)
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
Name: fence-agents
|
||||
Summary: Set of unified programs capable of host isolation ("fencing")
|
||||
Version: 4.16.0
|
||||
Release: 11%{?alphatag:.%{alphatag}}%{?dist}
|
||||
Release: 12%{?alphatag:.%{alphatag}}%{?dist}
|
||||
License: GPL-2.0-or-later AND LGPL-2.0-or-later
|
||||
URL: https://github.com/ClusterLabs/fence-agents
|
||||
Source0: https://fedorahosted.org/releases/f/e/fence-agents/%{name}-%{version}.tar.gz
|
||||
@ -112,6 +112,7 @@ Patch11: RHEL-68322-1-fence_nutanix_ahv-handle-api-rate-limits.patch
|
||||
Patch12: RHEL-68322-2-fence_nutanix_ahv-update-metadata.patch
|
||||
Patch13: RHEL-88569-fence_ibm_powervs-fix-plaintext-token-file-support.patch
|
||||
Patch14: RHEL-95379-fence_kubevirt-force-off.patch
|
||||
Patch15: RHEL-107504-fence_ibm_vpc-add-apikey-file-support.patch
|
||||
|
||||
%global supportedagents amt_ws apc apc_snmp bladecenter brocade cisco_mds cisco_ucs drac5 eaton_snmp emerson eps hpblade ibmblade ibm_powervs ibm_vpc ifmib ilo ilo_moonshot ilo_mp ilo_ssh intelmodular ipdu ipmilan kdump kubevirt lpar mpath nutanix_ahv redfish rhevm rsa rsb sbd scsi vmware_rest vmware_soap wti
|
||||
%ifarch x86_64
|
||||
@ -235,6 +236,7 @@ BuildRequires: %{systemd_units}
|
||||
%patch -p1 -P 12
|
||||
%patch -p1 -P 13
|
||||
%patch -p1 -P 14
|
||||
%patch -p1 -P 15
|
||||
|
||||
# prevent compilation of something that won't get used anyway
|
||||
sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac
|
||||
@ -1207,6 +1209,10 @@ are located on corosync cluster nodes.
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Aug 12 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.16.0-12
|
||||
- fence_ibm_vpc: add apikey file support
|
||||
Resolves: RHEL-107504
|
||||
|
||||
* Fri Jun 13 2025 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.16.0-11
|
||||
- fence_kubevirt: use hard poweroff
|
||||
Resolves: RHEL-95379
|
||||
|
||||
Loading…
Reference in New Issue
Block a user