in fiosynth_lib/flash_config.py [0:0]
def drivesToJson():
lb = subprocess.Popen(["/bin/lsblk", "-rnb"], stdout=subprocess.PIPE)
drives = {}
TYPE = 5
DEVICE = 0
maxcol = max(TYPE, DEVICE)
for line in lb.stdout:
bits = line.split()
if len(bits) > maxcol:
drive_type = bits[TYPE].decode("utf-8")
drive_device = bits[DEVICE].decode("utf-8")
drives.setdefault(drive_type, [])
drives[drive_type].append(drive_device)
return json.dumps(drives)