1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-15 00:05:11 +02:00

make empty mountpoints list instead of null

This commit is contained in:
Kelly Brazil
2025-03-31 14:29:27 -07:00
parent 9efc014dce
commit ca73076b56

View File

@ -26,7 +26,7 @@ Schema:
"type": string,
"mountpoint": string,
"mountpoints": [
string # null if no mountpoints
string
],
"kname": string,
"fstype": string,
@ -380,8 +380,11 @@ def parse(data, raw=False, quiet=False):
# find multiple mount points and add to a single entry
for entry in raw_output:
if entry['name']:
if 'mountpoints' in entry and entry['mountpoints']:
entry['mountpoints'] = [entry['mountpoints']]
if 'mountpoints' in entry:
if entry['mountpoints']:
entry['mountpoints'] = [entry['mountpoints']]
else:
entry['mountpoints'] = []
new_list.append(entry)
elif 'mountpoints' in entry and entry['mountpoints']:
new_list[-1]['mountpoints'].append(entry['mountpoints'])