2
0
mirror of https://opendev.org/x/pyghmi synced 2026-08-28 17:46:44 +00:00

Fix size of SDR records becoming a float

While receiving the SDR, when the size is uneven, its division by 2
causes it to become a float instead of an integer, leading to a
TypeError later on:

Traceback (most recent call last):
  File "gipmi/sdr.py", line 634, in __init__
    self.read_info()
  File "gipmi/sdr.py", line 665, in read_info
    self.get_sdr()
  File "gipmi/sdr.py", line 740, in get_sdr
    sdrrec = self.ipmicmd.raw_command(netfn=0x0a, command=0x23,
  File "gipmi/command.py", line 500, in raw_command
    rsp = self.ipmi_session.raw_command(netfn=netfn, command=command,
  File "gipmi/private/session.py", line 779, in raw_command
    self._send_ipmi_net_payload(netfn, command, data,
  File "gipmi/private/session.py", line 819, in _send_ipmi_net_payload
    data = bytearray(data)
TypeError: 'float' object cannot be interpreted as an integer

Change-Id: I3e123487b27ef385823b1a20652195c7588f5d6c
This commit is contained in:
Jan-Philipp Litza
2021-11-24 16:54:18 +01:00
parent 1ef6a0cb8b
commit 813de399b5
+1 -1
View File
@@ -778,7 +778,7 @@ class SDR(object):
if size == 0xff: # get just 5 to get header to know length
size = 5
elif size > 5:
size /= 2
size //= 2
# push things over such that it's less
# likely to be just 1 short of a read
# and incur a whole new request