From da9f801c1f834453be86a928b4beaa3bfada4459 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 20 May 2013 10:44:12 -0400 Subject: [PATCH] Clean up ipmi_session a little bit --- ipmi_session.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ipmi_session.py b/ipmi_session.py index dd2e2f64..a4e50a04 100644 --- a/ipmi_session.py +++ b/ipmi_session.py @@ -43,7 +43,7 @@ def get_ipmi_error(response,suffix=""): if 'error' in response: return response['error']+suffix code = response['code'] - command = response['cmd'] + command = response['commmand'] if code == 0: return False if command in command_completion_codes and code in command_completion_codes[command]: @@ -621,19 +621,16 @@ class ipmi_session: del ipmi_session.waiting_sessions[self] self.lastpayload=None #render retry mechanism utterly incapable of doing anything, though it shouldn't matter self.last_payload_type=None + response={} + response['netfn'] = payload[1]>>2 del payload[0:5] # remove header of rsaddr/netfn/lun/checksum/rq/seq/lun del payload[-1] # remove the trailing checksum - response={} - response['cmd']=payload[0] + response['commmand']=payload[0] response['code']=payload[1] del payload[0:2] response['data']=payload self.timeout=initialtimeout+(0.5*random()) - if self.ipmicallbackargs is not None: - args=(response,self.ipmicallbackargs) - else: - args=(response,) - self.ipmicallback(*args) + call_with_optional_args(self.ipmicallback,response,self.ipmicallbackargs) def _timedout(self): raise Exception("TODO: proper retries")