socialnerds/hive
socialnerds
/
hive
Archived
1
0
Fork 0

Renamed gather() to update() in disk_mon.py

This commit is contained in:
David 2012-05-20 17:20:46 +02:00
parent f084e1303e
commit 326b4d70d5
1 changed files with 9 additions and 13 deletions

View File

@ -1,25 +1,21 @@
#!/usr/bin/python2 #!/usr/bin/python2
# """ disk monitor """
# disk monitor
#
#imports
import os
class diskmon(object): class diskmon(object):
"""collect information about local partitions""" """collect information about local partitions"""
def __init__(self): def __init__(self):
self.gather() self.update()
def gather(self): def update(self):
"""gather the actual information""" """run collection of data"""
self.partitions = [] #information about all partitions (list of lists) import os
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 self.partitions = []
uuids = os.listdir("/dev/disk/by-uuid")
for uuid in uuids:
part = {} part = {}
part["device"] = str("/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:]) part["device"] = str("/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:])
part["uuid"] = uuid part["uuid"] = uuid