add "size_{total,free}" to the "mount" facts

This commit is contained in:
Michael Vogt 2013-05-31 21:01:45 +02:00
parent e75ab08e3d
commit 73a12b04a4

View file

@ -555,7 +555,16 @@ class LinuxHardware(Hardware):
for line in mtab.split('\n'): for line in mtab.split('\n'):
if line.startswith('/'): if line.startswith('/'):
fields = line.rstrip('\n').split() fields = line.rstrip('\n').split()
self.facts['mounts'].append({'mount': fields[1], 'device':fields[0], 'fstype': fields[2], 'options': fields[3]}) statvfs_result = os.statvfs(fields[1])
self.facts['mounts'].append(
{'mount': fields[1],
'device':fields[0],
'fstype': fields[2],
'options': fields[3],
# statvfs
'size_total': statvfs_result.f_bsize * statvfs_result.f_blocks,
'size_free': statvfs_result.f_bsize * statvfs_result.f_bfree,
})
def get_device_facts(self): def get_device_facts(self):
self.facts['devices'] = {} self.facts['devices'] = {}