Avoid crash if fstype is None
* Set fstype to 'UNKNOWN FS' if it's an empty string or None * Ensure all v_data values are strings before replacing text * Fixes issue #53 (again)
This commit is contained in:
parent
62e78cdc2c
commit
e0c3716e08
1 changed files with 5 additions and 0 deletions
|
|
@ -248,6 +248,10 @@ class osTicket():
|
|||
# Ensure string type
|
||||
label = ''
|
||||
fstype = v_data.get('fstype', 'UNKNOWN FS')
|
||||
if not fstype:
|
||||
# Either empty string or None
|
||||
fstype = 'UNKNOWN FS'
|
||||
fstype = str(fstype).upper()
|
||||
size = v_data.get('size', '')
|
||||
if size:
|
||||
size = '{} {}B'.format(size[:-1], size[-1:]).upper()
|
||||
|
|
@ -256,6 +260,7 @@ class osTicket():
|
|||
size_used = v_data.get('size_used', 'UNKNOWN').upper()
|
||||
size_avail = v_data.get('size_avail', 'UNKNOWN').upper()
|
||||
v_data = [v_path, label, size, fstype, size_used, size_avail]
|
||||
v_data = [str(v) for v in v_data]
|
||||
v_data = [v.strip().replace(' ', '_') for v in v_data]
|
||||
for i in range(len(v_data)):
|
||||
pad = 8
|
||||
|
|
|
|||
Loading…
Reference in a new issue