From b119de345b731549c16a55695aff40ec28735bf6 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Sun, 9 Aug 2026 07:08:39 +0200 Subject: [PATCH] Remove shadowed duplicate definitions (F811) Three names were defined twice in the same scope, so the first definition was unreachable: - lenovo OEM handler: two set_user_access methods, the second silently replacing the first. That made the SMM privilege update dead code. The conditions are mutually exclusive (is_fpc returns None once has_xcc is true), so merge both into the surviving method. - redfish plugin handle_cert_authorities and prepfish disable_host_interface: byte identical copies, drop the redundant one. --- .../aiohmi/ipmi/oem/lenovo/handler.py | 6 ++--- .../plugins/hardwaremanagement/redfish.py | 22 ------------------- misc/prepfish.py | 4 ---- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/confluent_server/aiohmi/ipmi/oem/lenovo/handler.py b/confluent_server/aiohmi/ipmi/oem/lenovo/handler.py index 2999ebdf..adea804e 100755 --- a/confluent_server/aiohmi/ipmi/oem/lenovo/handler.py +++ b/confluent_server/aiohmi/ipmi/oem/lenovo/handler.py @@ -409,6 +409,8 @@ class OEMHandler(generic.OEMHandler): privilege_level): if await self.is_fpc() and self._fpc_variant != 6: await self.smmhandler.set_user_priv(uid, privilege_level) + if await self.has_xcc(): + await self.immhandler.set_user_access(uid, privilege_level) async def is_fpc(self): """True if the target is a Lenovo nextscale fan power controller""" @@ -1361,10 +1363,6 @@ class OEMHandler(generic.OEMHandler): return await self.immhandler.get_user_privilege_level(uid) return None - async def set_user_access(self, uid, channel, callback, link_auth, ipmi_msg, privilege_level): - if await self.has_xcc(): - await self.immhandler.set_user_access(uid, privilege_level) - async def process_zero_fru(self, zerofru): if (self.oemid['manufacturer_id'] == 19046 and self.oemid['product_id'] == 13616): diff --git a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py index 51a4fe4b..ebc64d8f 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py @@ -637,28 +637,6 @@ class IpmiHandler: os.unlink(certname) await self.ipmicmd.install_bmc_certificate(cert) - async def handle_cert_authorities(self): - if len(self.element) == 3: - if self.op == 'read': - async for cert in self.ipmicmd.get_trusted_cas(): - await self.output.put(msg.ChildCollection(cert['id'])) - elif self.op == 'update': - cert = self.inputdata.get_pem(self.node) - await self.ipmicmd.add_trusted_ca(cert) - elif len(self.element) == 4: - certid = self.element[-1] - if self.op == 'read': - async for certdata in self.ipmicmd.get_trusted_cas(): - if certdata['id'] == certid: - await self.output.put(msg.CertificateAuthority( - pem=certdata['pem'], - node=self.node, - subject=certdata['subject'], - san=certdata.get('san', None))) - elif self.op == 'delete': - await self.ipmicmd.del_trusted_ca(certid) - return - async def handle_alerts(self): if self.element[3] == 'destinations': if len(self.element) == 4: diff --git a/misc/prepfish.py b/misc/prepfish.py index 8b9bc914..79861114 100644 --- a/misc/prepfish.py +++ b/misc/prepfish.py @@ -232,10 +232,6 @@ def dotwait(): sys.stderr.flush() time.sleep(0.5) -def disable_host_interface(): - s = Session('/dev/ipmi0') - s.raw_command(netfn=0xc, command=1, data=(1, 0xc1, 0)) - def get_redfish_creds(): os.makedirs('/run/redfish', exist_ok=True, mode=0o700) try: