Merge "Add returns to send_raw() ipmitool function"
This commit is contained in:
commit
876f177f93
@ -651,9 +651,10 @@ def send_raw(task, raw_bytes):
|
||||
|
||||
:param task: a TaskManager instance.
|
||||
:param raw_bytes: a string of raw bytes to send, e.g. '0x00 0x01'
|
||||
:returns: a tuple with stdout and stderr.
|
||||
:raises: IPMIFailure on an error from ipmitool.
|
||||
:raises: MissingParameterValue if a required parameter is missing.
|
||||
:raises: InvalidParameterValue when an invalid value is specified.
|
||||
:raises: InvalidParameterValue when an invalid value is specified.
|
||||
|
||||
"""
|
||||
node_uuid = task.node.uuid
|
||||
@ -673,6 +674,8 @@ def send_raw(task, raw_bytes):
|
||||
{'node_id': node_uuid, 'error': e})
|
||||
raise exception.IPMIFailure(cmd=cmd)
|
||||
|
||||
return out, err
|
||||
|
||||
|
||||
def dump_sdr(task, file_path):
|
||||
"""Dump SDR data to a file.
|
||||
|
@ -2107,3 +2107,13 @@ class IPMIToolDriverTestCase(db_base.DbTestCase):
|
||||
self.assertRaises(exception.IPMIFailure, ipmi.dump_sdr, task,
|
||||
'foo_file')
|
||||
mock_exec.assert_called_once_with(self.info, 'sdr dump foo_file')
|
||||
|
||||
@mock.patch.object(ipmi, '_exec_ipmitool', autospec=True)
|
||||
def test_send_raw_bytes_returns(self, mock_exec):
|
||||
fake_ret = ('foo', 'bar')
|
||||
mock_exec.return_value = fake_ret
|
||||
|
||||
with task_manager.acquire(self.context, self.node.uuid) as task:
|
||||
ret = ipmi.send_raw(task, 'fake raw')
|
||||
|
||||
self.assertEqual(fake_ret, ret)
|
||||
|
Loading…
x
Reference in New Issue
Block a user