From 92c9abc74a3ce0c2d4c618d2e33dcdbc9ea33b8f Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 10 Aug 2026 04:39:28 +0200 Subject: [PATCH] Await the remaining reachable coroutines sockapi sent its collective refusal without awaiting tlvdata.send. redfish handle_sensors returned a coroutine from most branches and None from the short ones, so the caller's await raised TypeError; it is a coroutine throughout now. console send_payload waited for a response without awaiting the wait. Two suppressions are pyrefly limitations rather than bugs: Session defines an async __new__, and the keepalive registry holds coroutine functions in an untyped dict. --- confluent_server/aiohmi/ipmi/console.py | 5 ++++- confluent_server/aiohmi/ipmi/private/session.py | 3 +++ .../confluent/plugins/hardwaremanagement/redfish.py | 12 ++++++------ confluent_server/confluent/sockapi.py | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/confluent_server/aiohmi/ipmi/console.py b/confluent_server/aiohmi/ipmi/console.py index b7465ea4..81965907 100644 --- a/confluent_server/aiohmi/ipmi/console.py +++ b/confluent_server/aiohmi/ipmi/console.py @@ -73,6 +73,9 @@ class Console(object): password = self.password port = self.port kg = self.kg + # Session defines an async __new__, so the constructor call is a + # coroutine, which pyrefly does not model. + # pyrefly: ignore[not-async] self.ipmi_session = await session.Session( bmc=bmc, userid=userid, password=password, port=port, kg=kg) # induce one iteration of the loop, now that we would be @@ -301,7 +304,7 @@ class Console(object): async def send_payload(self, payload, payload_type=1, retry=True, needskeepalive=False): while not (self.connected or self.broken): - session.Session.wait_for_rsp(timeout=10) + await session.Session.wait_for_rsp(timeout=10) if self.ipmi_session is None or not self.ipmi_session.logged: await self._print_error('Session no longer connected') raise exc.IpmiException('Session no longer connected') diff --git a/confluent_server/aiohmi/ipmi/private/session.py b/confluent_server/aiohmi/ipmi/private/session.py index 1842d955..2bbb628e 100644 --- a/confluent_server/aiohmi/ipmi/private/session.py +++ b/confluent_server/aiohmi/ipmi/private/session.py @@ -1354,6 +1354,9 @@ class Session(object): # deregister continue if callable(cmd): + # registered callables are coroutine functions, + # but the registry itself is untyped + # pyrefly: ignore[not-async] await cmd() continue keptalive = True diff --git a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py index ebc64d8f..86800d21 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py @@ -1133,23 +1133,23 @@ class IpmiHandler: return await self._show_all_storage() - def handle_sensors(self): + async def handle_sensors(self): if self.element[-1] == '': self.element = self.element[:-1] if len(self.element) < 3: return self.sensorcategory = self.element[2] if self.sensorcategory == 'normalized': - return self.read_normalized(self.element[-1]) + return await self.read_normalized(self.element[-1]) # list sensors per category if len(self.element) == 3 and self.element[-2] == 'hardware': if self.sensorcategory == 'leds': - return self.list_leds() - return self.list_sensors() + return await self.list_leds() + return await self.list_sensors() elif len(self.element) == 4: # resource requested if self.sensorcategory == 'leds': - return self.read_leds(self.element[-1]) - return self.read_sensors(self.element[-1]) + return await self.read_leds(self.element[-1]) + return await self.read_sensors(self.element[-1]) def match_sensor(self, sensor): if self.sensorcategory == 'all': diff --git a/confluent_server/confluent/sockapi.py b/confluent_server/confluent/sockapi.py index 3bdc15f8..51b5dbdd 100644 --- a/confluent_server/confluent/sockapi.py +++ b/confluent_server/confluent/sockapi.py @@ -156,7 +156,7 @@ async def sessionhdl(connection, authname, skipauth=False, cert=None): return await collective.handle_connection( connection, None, request['collective'], local=True) else: - tlvdata.send( + await tlvdata.send( connection, {'collective': { 'error': 'collective management commands '