Include filesystem type in volume reports

* Fixes issue #53
This commit is contained in:
2Shirt 2019-02-26 22:07:14 -07:00
parent bc4fa92e16
commit 9333fb8f3e
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 6 additions and 3 deletions

View file

@ -333,6 +333,7 @@ def mount_volumes(
if vol_data['show_data']['data'] == 'Failed to mount': if vol_data['show_data']['data'] == 'Failed to mount':
vol_data['mount_point'] = None vol_data['mount_point'] = None
else: else:
fstype = vol_data.get('fstype', 'UNKNOWN FS')
size_used = human_readable_size( size_used = human_readable_size(
mounted_volumes[vol_path]['used']) mounted_volumes[vol_path]['used'])
size_avail = human_readable_size( size_avail = human_readable_size(
@ -342,8 +343,9 @@ def mount_volumes(
vol_data['mount_point'] = mounted_volumes[vol_path]['target'] vol_data['mount_point'] = mounted_volumes[vol_path]['target']
vol_data['show_data']['data'] = 'Mounted on {}'.format( vol_data['show_data']['data'] = 'Mounted on {}'.format(
mounted_volumes[vol_path]['target']) mounted_volumes[vol_path]['target'])
vol_data['show_data']['data'] = '{:40} ({} used, {} free)'.format( vol_data['show_data']['data'] = '{:40} ({}, {} used, {} free)'.format(
vol_data['show_data']['data'], vol_data['show_data']['data'],
fstype,
size_used, size_used,
size_avail) size_avail)

View file

@ -247,6 +247,7 @@ class osTicket():
else: else:
# Ensure string type # Ensure string type
label = '' label = ''
fstype = v_data.get('fstype', 'UNKNOWN FS')
size = v_data.get('size', '') size = v_data.get('size', '')
if size: if size:
size = '{} {}B'.format(size[:-1], size[-1:]).upper() size = '{} {}B'.format(size[:-1], size[-1:]).upper()
@ -254,7 +255,7 @@ class osTicket():
size = 'UNKNOWN' size = 'UNKNOWN'
size_used = v_data.get('size_used', 'UNKNOWN').upper() size_used = v_data.get('size_used', 'UNKNOWN').upper()
size_avail = v_data.get('size_avail', 'UNKNOWN').upper() size_avail = v_data.get('size_avail', 'UNKNOWN').upper()
v_data = [v_path, label, size, size_used, size_avail] v_data = [v_path, label, size, fstype, size_used, size_avail]
v_data = [v.strip().replace(' ', '_') for v in v_data] v_data = [v.strip().replace(' ', '_') for v in v_data]
for i in range(len(v_data)): for i in range(len(v_data)):
pad = 8 pad = 8
@ -266,7 +267,7 @@ class osTicket():
v_data[-1] = re.sub(r'\.*$', '', v_data[-1]) v_data[-1] = re.sub(r'\.*$', '', v_data[-1])
v_data = [v.replace('_', ' ') for v in v_data] v_data = [v.replace('_', ' ') for v in v_data]
report.append( report.append(
'{}..{}..Total..{}..(Used..{}..Free..{})'.format(*v_data)) '{}..{}..Total..{}..({}..Used..{}..Free..{})'.format(*v_data))
# Done # Done
return report return report