diff --git a/interface/ri_data.py b/interface/ri_data.py index 5367082..253116c 100644 --- a/interface/ri_data.py +++ b/interface/ri_data.py @@ -69,9 +69,9 @@ class Partition: for s in o.splitlines(): ret = re.search(r".+([sh][a-zA-Z]+)\s*",s) if ret: - if ret.group(1) in device_list: - continue - device_list.append(ret.group(1)) + if ret.group(1) in device_list: + continue + device_list.append(ret.group(1)) for d in device_list: st,o=commands.getstatusoutput('parted /dev/%s unit %s print'%(d,Partition.unit)) @@ -79,35 +79,35 @@ class Partition: print "Error parted :command not found" return for s in o.splitlines(): - ret = p.split(s) - if ret[0]=='Partition': - Partition.label=ret[-1] - if len(ret) > 1 and ret[1].isdigit(): - # ret[0] is [''] - #Number start end size type file_system flags - # 1 2.0B 33GB 1GB primary raid - # 2 32GB 33GB 1GB primary raid, boot ... - # 3 32GB 33GB 1GB primary boot, raid, lbx ... - # 4 32GB 33GB 1GB primary exit2 raid - # 5 32GB 33GB 1GB primary exit2 raid, boot ... - # 6 3.2kB 33GB 1GB primary - # 7 32GB 33GB 1GB primary linx-swap - # 8 32GB 33GB 1GB primary boot, lbx ... - # 9 32GB 33GB 1GB primary exit2 boot - #ret[1] ret[2] ret[3] ret[4] ret[5] ret[6] ret[7] - ret+=['','',''] - ret[2]=ret[2][:-len(Partition.unit)] - ret[3]=ret[3][:-len(Partition.unit)] - ret[4]=ret[4][:-len(Partition.unit)] - if "raid" in ret[6:] or "raid," in ret[6:]: - ret[7]='yes' - if ret[6][:3].lower()=='raid' or ret[6].lower() not in fs_list: - ret[6]='' - else: - ret[7]='no' - if ret[6].lower() not in fs_list: - ret[6]='' - Partition(d+ret[1],ret[2],ret[4],ret[5],ret[6][:10] == "linux-swap" and "swap" or ret[6] ,ret[7],'yes') + ret = p.split(s) + if ret[0]=='Partition': + Partition.label=ret[-1] + if len(ret) > 1 and ret[1].isdigit(): + # ret[0] is [''] + #Number start end size type file_system flags + # 1 2.0B 33GB 1GB primary raid + # 2 32GB 33GB 1GB primary raid, boot ... + # 3 32GB 33GB 1GB primary boot, raid, lbx ... + # 4 32GB 33GB 1GB primary exit2 raid + # 5 32GB 33GB 1GB primary exit2 raid, boot ... + # 6 3.2kB 33GB 1GB primary + # 7 32GB 33GB 1GB primary linx-swap + # 8 32GB 33GB 1GB primary boot, lbx ... + # 9 32GB 33GB 1GB primary exit2 boot + #ret[1] ret[2] ret[3] ret[4] ret[5] ret[6] ret[7] + ret+=['','',''] + ret[2]=ret[2][:-len(Partition.unit)] + ret[3]=ret[3][:-len(Partition.unit)] + ret[4]=ret[4][:-len(Partition.unit)] + if "raid" in ret[6:] or "raid," in ret[6:]: + ret[7]='yes' + if ret[6][:3].lower()=='raid' or ret[6].lower() not in fs_list: + ret[6]='' + else: + ret[7]='no' + if ret[6].lower() not in fs_list: + ret[6]='' + Partition(d+ret[1],ret[2],ret[4],ret[5],ret[6][:10] == "linux-swap" and "swap" or ret[6] ,ret[7],'yes') @staticmethod