socialnerds/hive
socialnerds
/
hive
Archived
1
0
Fork 0

added generator

This commit is contained in:
David 2012-05-20 14:21:15 +02:00
parent ef8c72ba78
commit c84bdd1c16
1 changed files with 13 additions and 5 deletions

View File

@ -15,15 +15,23 @@ class diskmon(object):
def __init__(self):
pass
def get_part(self):
uuids = os.listdir("/dev/disk/by-uuid")
for uuid in uuids:
part = []
part.append("/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:])
yield part.append(uuid)
def gather(self):
"""gather the actual information"""
self.partitions = [] #information about all partitions (list of lists)
part = [] #information about one partition
uuids = os.listdir("/dev/disk/by-uuid") #folder contains symlinks to the actual disk devices
for uuid in uuids: #write /dev/names as keys and uuids as values in the dictionary
part.append("/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:])
part.append(uuid)
#uuids = os.listdir("/dev/disk/by-uuid") #folder contains symlinks to the actual disk devices
#for uuid in uuids: #write /dev/names as keys and uuids as values in the dictionary
# part = []
# part.append("/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:])
# part.append(uuid)
for part in self.get_part():
#getting mountpoint for partition from mtab
mtab = open("/etc/mtab", "r")