|
|
@ -626,28 +626,27 @@ class LinuxHardware(Hardware):
|
|
|
|
if line.startswith('/'):
|
|
|
|
if line.startswith('/'):
|
|
|
|
fields = line.rstrip('\n').split()
|
|
|
|
fields = line.rstrip('\n').split()
|
|
|
|
if(fields[2] != 'none'):
|
|
|
|
if(fields[2] != 'none'):
|
|
|
|
|
|
|
|
size_total = None
|
|
|
|
|
|
|
|
size_available = None
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
statvfs_result = os.statvfs(fields[1])
|
|
|
|
statvfs_result = os.statvfs(fields[1])
|
|
|
|
self.facts['mounts'].append(
|
|
|
|
size_total = statvfs_result.f_bsize * statvfs_result.f_blocks
|
|
|
|
{'mount': fields[1],
|
|
|
|
size_available = statvfs_result.f_bsize * (statvfs_result.f_bavail)
|
|
|
|
'device':fields[0],
|
|
|
|
|
|
|
|
'fstype': fields[2],
|
|
|
|
|
|
|
|
'options': fields[3],
|
|
|
|
|
|
|
|
# statvfs data
|
|
|
|
|
|
|
|
'size_total': statvfs_result.f_bsize * statvfs_result.f_blocks,
|
|
|
|
|
|
|
|
'size_available': statvfs_result.f_bsize * (statvfs_result.f_bavail),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
except OSError, e:
|
|
|
|
except OSError, e:
|
|
|
|
# don't have access to stat so we'll set to None
|
|
|
|
if e.errno == errno.ENOENT:
|
|
|
|
self.facts['mounts'].append(
|
|
|
|
pass
|
|
|
|
{'mount': fields[1],
|
|
|
|
else:
|
|
|
|
'device':fields[0],
|
|
|
|
self.fail_json(msg=e.strerror)
|
|
|
|
'fstype': fields[2],
|
|
|
|
|
|
|
|
'options': fields[3],
|
|
|
|
self.facts['mounts'].append(
|
|
|
|
# statvfs data
|
|
|
|
{'mount': fields[1],
|
|
|
|
'size_total': None,
|
|
|
|
'device':fields[0],
|
|
|
|
'size_available': None,
|
|
|
|
'fstype': fields[2],
|
|
|
|
})
|
|
|
|
'options': fields[3],
|
|
|
|
|
|
|
|
# statvfs data
|
|
|
|
|
|
|
|
'size_total': size_total,
|
|
|
|
|
|
|
|
'size_available': size_available,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
def get_device_facts(self):
|
|
|
|
def get_device_facts(self):
|
|
|
|
self.facts['devices'] = {}
|
|
|
|
self.facts['devices'] = {}
|
|
|
|