Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipmi: ignore unexpected id lines #184

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyipmi/interfaces/ipmitool.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ def _parse_output(self, output):
# Don't try to parse ipmitool error messages
if 'failed' in line:
continue
# Don't try to parse spurious ipmitool output
if 'Received a response with unexpected ID' in line:
continue

# Check for timeout
if self.re_timeout.match(line):
Expand Down
7 changes: 7 additions & 0 deletions tests/interfaces/test_ipmitool.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ def test_parse_output_rsp_suppressed_error(self):
assert cc is None
assert py3_array_tobytes(rsp) == b'\x12\x34\x56\x78\xd0\x0f\xaf\xfe\xde\xad\xbe\xef\xaa\x55\xbb'

def test_parse_output_rsp_suppressed_unexpected_id(self):
test_str = b'Received a response with unexpected ID 0 vs. 1\n'\
b' 12 34 56 78 \r\n d0 0f af fe de ad be ef\naa 55\r\nbb \n'
cc, rsp = self._interface._parse_output(test_str)
assert cc is None
assert py3_array_tobytes(rsp) == b'\x12\x34\x56\x78\xd0\x0f\xaf\xfe\xde\xad\xbe\xef\xaa\x55\xbb'

def test_parse_output_cc(self):
test_str = b'Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0 cmd=0x1 rsp=0xcc): Ignore Me\n'
cc, rsp = self._interface._parse_output(test_str)
Expand Down
Loading