From 46228d23a1af36a2ae2c83bd1b7ca74e633328f0 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 31 Jan 2014 15:23:34 -0500 Subject: [PATCH] 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 --- pyghmi/ipmi/console.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/console.py b/pyghmi/ipmi/console.py index 1a04dab8..3fe4e3da 100644 --- a/pyghmi/ipmi/console.py +++ b/pyghmi/ipmi/console.py @@ -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]