Ticket #2: megaclisas-status.diff

File megaclisas-status.diff, 985 bytes (added by gandalf, 3 years ago)

New patch that doesn't modify output style

  • megaclisas-status

    old new  
    5252        if re.match(r'^RAID Level:.*$',line.strip()): 
    5353            type = 'RAID'+line.strip().split(':')[1].split(',')[0].split('-')[1].strip() 
    5454        if re.match(r'^Size:.*$',line.strip()): 
    55             size = line.strip().split(':')[1].strip('MB').strip() 
    56             size = str(int(round((float(size) / 1000))))+'G' 
     55            if re.match(r'^.*MB$',line.strip().split(':')[1]): 
     56                size = line.strip().split(':')[1].strip('MB').strip() 
     57                size = str(int(round((float(size) / 1000))))+'G' 
     58            else: 
     59                size = line.strip().split(':')[1].strip('GB').strip() 
     60                size = str(int(round((float(size)))))+'G' 
    5761        if re.match(r'^State:.*$',line.strip()): 
    5862            state = line.strip().split(':')[1].strip() 
    5963        if re.match(r'^Ongoing Progresses:.*$',line.strip()):