Skip to content

RMCP support broken in 0.5.8 #196

@patrislav1

Description

@patrislav1

The update from 0.5.7 to 0.5.8 breaks RMCP support.

Any code that uses python-ipmi in RMCP mode will abort with this error:

  File "/home/huesmann/src/mmcterm/.venv/lib/python3.12/site-packages/pyipmi/session.py", line 118, in establish
    self.interface.establish_session(self)
  File "/home/huesmann/src/mmcterm/.venv/lib/python3.12/site-packages/pyipmi/interfaces/rmcp.py", line 523, in establish_session
    self.ping()
  File "/home/huesmann/src/mmcterm/.venv/lib/python3.12/site-packages/pyipmi/interfaces/rmcp.py", line 464, in ping
    self._send_asf_msg(ping)
  File "/home/huesmann/src/mmcterm/.venv/lib/python3.12/site-packages/pyipmi/interfaces/rmcp.py", line 451, in _send_asf_msg
    self._send_rmcp_msg(msg.pack(), RMCP_CLASS_ASF)
  File "/home/huesmann/src/mmcterm/.venv/lib/python3.12/site-packages/pyipmi/interfaces/rmcp.py", line 419, in _send_rmcp_msg
    self._sock.sendto(pdu, (self.host, self.port))
    ^^^^^^^^^^
AttributeError: 'Rmcp' object has no attribute '_sock'

A minimal snippet to reproduce the error can be taken straight from the documentation:

import pyipmi
import pyipmi.interfaces

interface = pyipmi.interfaces.create_interface(
    interface="rmcp",
    slave_address=0x81,
    host_target_address=0x20,
    keep_alive_interval=1,
)
ipmi = pyipmi.create_connection(interface)
ipmi.session.set_session_type_rmcp(host="10.0.114.199", port=623)
ipmi.session.set_auth_type_user(username="admin", password="admin")

ipmi.target = pyipmi.Target(ipmb_address=0x20)

ipmi.session.establish()
device_id = ipmi.get_device_id()

The last commit on the RCMP interface moved the socket initialization from the constructor to a dedicated open() method, but it is unclear how to trigger that logic or if you're even supposed to call it explicitly as a user.

Let me know if I can do anything to help fix this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions