From 3fb4583c97cf8fcb4a2154f2d909080fbb66cfa6 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Wed, 1 Apr 2015 22:10:47 -0400 Subject: [PATCH] Very minor bugfixes (Rev 1.29) --- wrapper-scripts/megaclisas-status | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/wrapper-scripts/megaclisas-status b/wrapper-scripts/megaclisas-status index 50347e1..f496ae0 100755 --- a/wrapper-scripts/megaclisas-status +++ b/wrapper-scripts/megaclisas-status @@ -1,5 +1,5 @@ #!/usr/bin/python -# $Id: megaclisas-status,v 1.28 2015/04/01 21:39:31 root Exp $ +# $Id: megaclisas-status,v 1.29 2015/04/01 22:10:47 root Exp $ import os import re @@ -126,6 +126,15 @@ def returnFirmwareVersion(output): if re.match(r'^FW Package Build.*$',line.strip()): return line.split(':')[1].strip() +def returnROCTemp(output): + ROCtemp = 0 + tmpstr = '' + for line in output: + if re.match(r'^ROC temperature :.*$',line.strip()): + tmpstr = line.split(':')[1].strip() + ROCtemp = re.sub(' +.*$', '', tmpstr) + return ROCtemp + def returnArrayNumber(output): i = 0 for line in output: @@ -341,18 +350,29 @@ if printcontroller: if controllernumber: print '-- Controller information --' - hbafmt = "%-5s | %s " - print hbafmt % ("-- ID","Model") + i = 0 controllerid = 0 + mlen = 0 while controllerid < controllernumber: cmd = '%s -AdpAllInfo -a%d -NoLog' % (megaclipath, controllerid) output = getOutput(cmd) controllermodel = returnControllerModel(output) controllerram = returnMemorySize(output) controllerrev = returnFirmwareVersion(output) + controllertemp = returnROCTemp(output) + if ( len(controllermodel) > mlen): + mlen = len(controllermodel) + + hbafmt = str('%-5s | %-'+str(mlen)+'s | %-6s | %-4s | %-12s ') + # Header + if ( i == 0 ): + print hbafmt % ("-- ID","H/W Model","RAM","Temp","Firmware") print hbafmt % ( 'c'+str(controllerid), - str(controllermodel+' ('+controllerram+') FW: '+controllerrev)) + controllermodel, + str(controllerram), + str(controllertemp+'C'), + str('FW: '+controllerrev)) controllerid += 1 print '' else: