kontron / python-ipmi

A pure python IPMI library
GNU Lesser General Public License v2.1
187 stars 74 forks source link

SDR record type 0x13 #116

Open hinxx opened 2 years ago

hinxx commented 2 years ago

When I run ipmitool.py .. sdr show <ID> against one of the SDR records on my machine I get this error:

SDR record ID:    0x0045
SDR type:         0x13
Traceback (most recent call last):
  File "/home/bddev/labmachines/venv/bin/ipmitool.py", line 11, in <module>
    sys.exit(main())
  File "/home/bddev/labmachines/venv/lib64/python3.6/site-packages/pyipmi/ipmitool.py", line 601, in main
    cmd(ipmi, args)
  File "/home/bddev/labmachines/venv/lib64/python3.6/site-packages/pyipmi/ipmitool.py", line 150, in cmd_sdr_show_all
    sdr_show(ipmi, s)
  File "/home/bddev/labmachines/venv/lib64/python3.6/site-packages/pyipmi/ipmitool.py", line 97, in sdr_show
    print("Device Id string: %s" % s.device_id_string)
AttributeError: 'SdrUnknownSensorRecord' object has no attribute 'device_id_string'

Running ipmitool.py .. sdr raw <ID> returns this:

0x45 0x00 0x51 0x13 0x1b 0x20 0x00 0x01 0x02 0x01 0x51 0x4a 0xc1 0x62 0x06 0x80 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

Looking at the source code the SDR record type 0x13 does not seems to be handled.. https://github.com/kontron/python-ipmi/blob/471e609a8b30a6ac876ab592aa24b4012cf95936/pyipmi/sdr.py#L37

If I kludge the code in https://github.com/kontron/python-ipmi/blob/471e609a8b30a6ac876ab592aa24b4012cf95936/pyipmi/ipmitool.py#L93 to skip over this record type the error is gone.

FWIW, ipmitool does not show this record ID in its output at all (looks like it skips it).

hthiery commented 2 years ago

just added support for that .. please test it and give a feedback

hinxx commented 2 years ago

Sorry for late response. I get the following error when running ipmitool.py ... sdr list command:

Traceback (most recent call last):
  File "/home/bddev/labmachines/venv/bin/ipmitool.py", line 11, in <module>
    load_entry_point('python-ipmi', 'console_scripts', 'ipmitool.py')()
  File "/home/bddev/labmachines/venv/src/python-ipmi/pyipmi/ipmitool.py", line 601, in main
    cmd(ipmi, args)
  File "/home/bddev/labmachines/venv/src/python-ipmi/pyipmi/ipmitool.py", line 199, in cmd_sdr_list
    print_sdr_list_entry(s.id, number, s.device_id_string,
AttributeError: 'SdrManagementControllerConfirmationRecord' object has no attribute 'device_id_string'