2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-16 04:38:19 +00:00

Allow special handling to preceed generic handler

The IPMI session layer now, with more constants defined, catches the SOL
error and populates 'error' message.  Move the generic handler code
to come after the specific condition handler to allow things like forced
sessions to work as expected.

Change-Id: I62ab5fc16a9af631317eff78b8445b06a76b56d8
This commit is contained in:
Jarrod Johnson 2014-01-31 15:23:34 -05:00
parent ed220d6ebd
commit 46228d23a1

View File

@ -89,8 +89,6 @@ class Console(object):
# 0, 0, 0 reserved
response = self.ipmi_session.raw_command(netfn=0x6, command=0x48,
data=(1, 1, 192, 0, 0, 0))
if 'error' in response:
self._print_error(response['error'])
#given that these are specific to the command,
#it's probably best if one can grep the error
#here instead of in constants
@ -100,7 +98,7 @@ class Console(object):
0x83: 'Cannot activate payload with encryption',
0x84: 'Cannot activate payload without encryption',
}
if response['code']:
if 'code' in response and response['code']:
if response['code'] in constants.ipmi_completion_codes:
self._print_error(
constants.ipmi_completion_codes[response['code']])
@ -125,6 +123,8 @@ class Console(object):
'SOL encountered Unrecognized error code %d' %
response['code'])
return
if 'error' in response:
self._print_error(response['error'])
#data[0:3] is reserved except for the test mode, which we don't use
data = response['data']
self.maxoutcount = (data[5] << 8) + data[4]