def _parse_output(output, template):
 ret = {}
 index = 0
 if (not (output and template)):
  return ret
 if ('translate' in template):
  ret = _translate_output(output)
 else:
  output_list = output.strip().replace('\n', '').split(' ')
  if (sum(template.values()) != len(output_list)):
   raise ipmiexcept.IPMIException(_('ipmitool output length mismatch'))
  for item in template.items():
   index_end = (index + item[1])
   update_value = output_list[index:index_end]
   ret[item[0]] = update_value
   index = index_end
 return ret

def _parse_output ( output , template ) : ret = { } index = 0 if ( not ( output and template ) ) : return ret if ( 'translate' in template ) : ret = _translate_output ( output ) else : output_list = output . strip ( ) . replace ( '\n' , '' ) . split ( ' ' ) if ( sum ( template . values ( ) ) != len ( output_list ) ) : raise ipmiexcept . IPMIException ( _ ( 'ipmitool output length mismatch' ) ) for item in template . items ( ) : index_end = ( index + item [ 1 ] ) update_value = output_list [ index : index_end ] ret [ item [ 0 ] ] = update_value index = index_end return ret
parse the return value of ipmi command into dict .