mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
make empty mountpoints list instead of null
This commit is contained in:
@ -26,7 +26,7 @@ Schema:
|
|||||||
"type": string,
|
"type": string,
|
||||||
"mountpoint": string,
|
"mountpoint": string,
|
||||||
"mountpoints": [
|
"mountpoints": [
|
||||||
string # null if no mountpoints
|
string
|
||||||
],
|
],
|
||||||
"kname": string,
|
"kname": string,
|
||||||
"fstype": string,
|
"fstype": string,
|
||||||
@ -380,8 +380,11 @@ def parse(data, raw=False, quiet=False):
|
|||||||
# find multiple mount points and add to a single entry
|
# find multiple mount points and add to a single entry
|
||||||
for entry in raw_output:
|
for entry in raw_output:
|
||||||
if entry['name']:
|
if entry['name']:
|
||||||
if 'mountpoints' in entry and entry['mountpoints']:
|
if 'mountpoints' in entry:
|
||||||
entry['mountpoints'] = [entry['mountpoints']]
|
if entry['mountpoints']:
|
||||||
|
entry['mountpoints'] = [entry['mountpoints']]
|
||||||
|
else:
|
||||||
|
entry['mountpoints'] = []
|
||||||
new_list.append(entry)
|
new_list.append(entry)
|
||||||
elif 'mountpoints' in entry and entry['mountpoints']:
|
elif 'mountpoints' in entry and entry['mountpoints']:
|
||||||
new_list[-1]['mountpoints'].append(entry['mountpoints'])
|
new_list[-1]['mountpoints'].append(entry['mountpoints'])
|
||||||
|
Reference in New Issue
Block a user