From 04221b75bab84f4757773c894770e6e595211159 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Wed, 20 Oct 2021 04:20:58 +0000 Subject: [PATCH] import fence-agents-4.2.1-78.el8 --- ...70827-all-agents-log-exceptions-fail.patch | 198 ++++++++++++++++++ ...010710-fence_amt_ws-fix-or-dead-code.patch | 22 ++ SPECS/fence-agents.spec | 12 +- 3 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 SOURCES/bz1470827-all-agents-log-exceptions-fail.patch create mode 100644 SOURCES/bz2010710-fence_amt_ws-fix-or-dead-code.patch diff --git a/SOURCES/bz1470827-all-agents-log-exceptions-fail.patch b/SOURCES/bz1470827-all-agents-log-exceptions-fail.patch new file mode 100644 index 0000000..34818be --- /dev/null +++ b/SOURCES/bz1470827-all-agents-log-exceptions-fail.patch @@ -0,0 +1,198 @@ +From bf32059e26f6a7d019df0f7949ce66adf997bc21 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Fri, 8 Feb 2019 14:16:31 +0100 +Subject: [PATCH] log exceptions to be more detailed when failing + +--- + agents/apc/fence_apc.py | 6 ++++-- + agents/cisco_ucs/fence_cisco_ucs.py | 3 ++- + agents/eps/fence_eps.py | 3 ++- + agents/ilo_moonshot/fence_ilo_moonshot.py | 3 ++- + agents/lpar/fence_lpar.py | 6 ++++-- + agents/ovh/fence_ovh.py | 3 ++- + agents/sanbox2/fence_sanbox2.py | 12 ++++++++---- + agents/vmware_soap/fence_vmware_soap.py | 9 ++++++--- + 8 files changed, 30 insertions(+), 15 deletions(-) + +diff --git a/agents/apc/fence_apc.py b/agents/apc/fence_apc.py +index 24a5a4232..dd0287f83 100644 +--- a/agents/apc/fence_apc.py ++++ b/agents/apc/fence_apc.py +@@ -90,7 +90,8 @@ def get_power_status(conn, options): + try: + (_, status) = outlets[options["--plug"]] + return status.lower().strip() +- except KeyError: ++ except KeyError as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_STATUS) + + def set_power_status(conn, options): +@@ -199,7 +200,8 @@ def get_power_status5(conn, options): + try: + (_, status) = outlets[options["--plug"]] + return status.lower().strip() +- except KeyError: ++ except KeyError as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_STATUS) + + def set_power_status5(conn, options): +diff --git a/agents/cisco_ucs/fence_cisco_ucs.py b/agents/cisco_ucs/fence_cisco_ucs.py +index ec3117548..2280dbbc7 100644 +--- a/agents/cisco_ucs/fence_cisco_ucs.py ++++ b/agents/cisco_ucs/fence_cisco_ucs.py +@@ -174,7 +174,8 @@ def main(): + if result == None: + ## Cookie is absenting in response + fail(EC_LOGIN_DENIED) +- except Exception: ++ except Exception as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_LOGIN_DENIED) + + options_global["cookie"] = result.group(1) +diff --git a/agents/eps/fence_eps.py b/agents/eps/fence_eps.py +index 74c89b95b..f0df86231 100644 +--- a/agents/eps/fence_eps.py ++++ b/agents/eps/fence_eps.py +@@ -56,7 +56,8 @@ def eps_run_command(options, params): + conn.close() + except socket.timeout: + fail(EC_TIMED_OUT) +- except socket.error: ++ except socket.error as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_LOGIN_DENIED) + + return result +diff --git a/agents/ilo_moonshot/fence_ilo_moonshot.py b/agents/ilo_moonshot/fence_ilo_moonshot.py +index a066a9c91..6f5cca320 100644 +--- a/agents/ilo_moonshot/fence_ilo_moonshot.py ++++ b/agents/ilo_moonshot/fence_ilo_moonshot.py +@@ -21,7 +21,8 @@ def get_power_status(conn, options): + try: + (_, status) = nodes[options["--plug"]] + return status.lower() +- except KeyError: ++ except KeyError as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_STATUS) + + def set_power_status(conn, options): +diff --git a/agents/lpar/fence_lpar.py b/agents/lpar/fence_lpar.py +index a16103733..66cb65e41 100644 +--- a/agents/lpar/fence_lpar.py ++++ b/agents/lpar/fence_lpar.py +@@ -37,7 +37,8 @@ def get_power_status(conn, options): + try: + status = re.compile("^" + options["--plug"] + ",(.*?),.*$", + re.IGNORECASE | re.MULTILINE).search(conn.before).group(1) +- except AttributeError: ++ except AttributeError as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_STATUS_HMC) + elif options["--hmc-version"] in ["4", "IVM"]: + conn.send("lssyscfg -r lpar -m "+ options["--managed"] + +@@ -49,7 +50,8 @@ def get_power_status(conn, options): + + try: + status = re.compile(",state=(.*?),", re.IGNORECASE).search(conn.before).group(1) +- except AttributeError: ++ except AttributeError as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_STATUS_HMC) + + return _normalize_status(status) +diff --git a/agents/ovh/fence_ovh.py b/agents/ovh/fence_ovh.py +index f5403c54d..2b7eb864f 100644 +--- a/agents/ovh/fence_ovh.py ++++ b/agents/ovh/fence_ovh.py +@@ -66,7 +66,8 @@ def soap_login(options): + try: + soap = Client(url, doctor=d) + session = soap.service.login(options["--username"], options["--password"], 'en', 0) +- except Exception: ++ except Exception as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_LOGIN_DENIED) + + options["session"] = session +diff --git a/agents/sanbox2/fence_sanbox2.py b/agents/sanbox2/fence_sanbox2.py +index 679d1d983..179fe0e8b 100644 +--- a/agents/sanbox2/fence_sanbox2.py ++++ b/agents/sanbox2/fence_sanbox2.py +@@ -28,7 +28,8 @@ def get_power_status(conn, options): + conn.send_eol("admin end") + conn.send_eol("exit") + conn.close() +- except Exception: ++ except Exception as e: ++ logging.error("Failed: {}".format(str(e))) + pass + fail(EC_TIMED_OUT) + +@@ -54,7 +55,8 @@ def set_power_status(conn, options): + conn.send_eol("admin end") + conn.send_eol("exit") + conn.close() +- except Exception: ++ except Exception as e: ++ logging.error("Failed: {}".format(str(e))) + pass + fail(EC_TIMED_OUT) + +@@ -66,7 +68,8 @@ def set_power_status(conn, options): + conn.send_eol("admin end") + conn.send_eol("exit") + conn.close() +- except Exception: ++ except Exception as e: ++ logging.error("Failed: {}".format(str(e))) + pass + fail(EC_TIMED_OUT) + +@@ -91,7 +94,8 @@ def get_list_devices(conn, options): + conn.send_eol("admin end") + conn.send_eol("exit") + conn.close() +- except Exception: ++ except Exception as e: ++ logging.error("Failed: {}".format(str(e))) + pass + fail(EC_TIMED_OUT) + +diff --git a/agents/vmware_soap/fence_vmware_soap.py b/agents/vmware_soap/fence_vmware_soap.py +index f2ab68b02..a7f08b3d6 100644 +--- a/agents/vmware_soap/fence_vmware_soap.py ++++ b/agents/vmware_soap/fence_vmware_soap.py +@@ -68,7 +68,8 @@ def soap_login(options): + conn.service.Login(mo_SessionManager, options["--username"], options["--password"]) + except requests.exceptions.SSLError as ex: + fail_usage("Server side certificate verification failed: %s" % ex) +- except Exception: ++ except Exception as e: ++ logging.error("Server side certificate verification failed: {}".format(str(e))) + fail(EC_LOGIN_DENIED) + + options["ServiceContent"] = ServiceContent +@@ -126,7 +127,8 @@ def get_power_status(conn, options): + + try: + raw_machines = conn.service.RetrievePropertiesEx(mo_PropertyCollector, propFilterSpec) +- except Exception: ++ except Exception as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_STATUS) + + (machines, uuid, mappingToUUID) = process_results(raw_machines, {}, {}, {}) +@@ -135,7 +137,8 @@ def get_power_status(conn, options): + while hasattr(raw_machines, 'token'): + try: + raw_machines = conn.service.ContinueRetrievePropertiesEx(mo_PropertyCollector, raw_machines.token) +- except Exception: ++ except Exception as e: ++ logging.error("Failed: {}".format(str(e))) + fail(EC_STATUS) + (more_machines, more_uuid, more_mappingToUUID) = process_results(raw_machines, {}, {}, {}) + machines.update(more_machines) diff --git a/SOURCES/bz2010710-fence_amt_ws-fix-or-dead-code.patch b/SOURCES/bz2010710-fence_amt_ws-fix-or-dead-code.patch new file mode 100644 index 0000000..bdbeab0 --- /dev/null +++ b/SOURCES/bz2010710-fence_amt_ws-fix-or-dead-code.patch @@ -0,0 +1,22 @@ +From 06855a8227fa91f6216119daa3d32d5858c62837 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Mon, 27 Sep 2021 12:05:41 +0200 +Subject: [PATCH] fence_amt_ws: fix "or" causing dead code + +--- + agents/amt_ws/fence_amt_ws.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/agents/amt_ws/fence_amt_ws.py b/agents/amt_ws/fence_amt_ws.py +index 23c8a61a4..122cec309 100755 +--- a/agents/amt_ws/fence_amt_ws.py ++++ b/agents/amt_ws/fence_amt_ws.py +@@ -148,7 +148,7 @@ def set_boot_order(_, client, options): + + if options["--boot-option"] == "pxe": + device = "Intel(r) AMT: Force PXE Boot" +- elif options["--boot-option"] == "hd" or "hdsafe": ++ elif options["--boot-option"] in ["hd", "hdsafe"]: + device = "Intel(r) AMT: Force Hard-drive Boot" + elif options["--boot-option"] == "cd": + device = "Intel(r) AMT: Force CD/DVD Boot" diff --git a/SPECS/fence-agents.spec b/SPECS/fence-agents.spec index 6642e74..f7a92c2 100644 --- a/SPECS/fence-agents.spec +++ b/SPECS/fence-agents.spec @@ -32,7 +32,7 @@ Name: fence-agents Summary: Set of unified programs capable of host isolation ("fencing") Version: 4.2.1 -Release: 77%{?alphatag:.%{alphatag}}%{?dist} +Release: 78%{?alphatag:.%{alphatag}}%{?dist} License: GPLv2+ and LGPLv2+ Group: System Environment/Base URL: https://github.com/ClusterLabs/fence-agents @@ -142,6 +142,8 @@ Patch93: bz1685814-fence_gce-add-serviceaccount-file-support.patch Patch94: bz1728203-bz1874862-fence_ibm_vpc-fence_ibm_powervs.patch Patch95: bz1969953-fence_gce-1-add-proxy-support.patch Patch96: bz1969953-fence_gce-2-bundled.patch +Patch97: bz1470827-all-agents-log-exceptions-fail.patch +Patch98: bz2010710-fence_amt_ws-fix-or-dead-code.patch %if 0%{?fedora} || 0%{?rhel} > 7 %global supportedagents amt_ws apc apc_snmp bladecenter brocade cisco_mds cisco_ucs compute drac5 eaton_snmp emerson eps evacuate hds_cb hpblade ibmblade ibm_powervs ibm_vpc ifmib ilo ilo_moonshot ilo_mp ilo_ssh intelmodular ipdu ipmilan kdump lpar mpath redfish rhevm rsa rsb sbd scsi vmware_rest vmware_soap wti @@ -322,6 +324,8 @@ BuildRequires: python3-pip %patch94 -p1 %patch95 -p1 %patch96 -p1 -F2 +%patch97 -p1 +%patch98 -p1 # prevent compilation of something that won't get used anyway sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac @@ -1227,6 +1231,12 @@ Fence agent for IBM z/VM over IP. %endif %changelog +* Tue Oct 19 2021 Oyvind Albrigtsen - 4.2.1-78 +- all agents: log exceptions when failing + Resolves: rhbz#1470827 +- fence_amt_ws: fix "or" causing dead code + Resolves: rhbz#2010710 + * Tue Sep 7 2021 Oyvind Albrigtsen - 4.2.1-77 - fence_gce: add proxy support Resolves: rhbz#1969953