Skip to content

Commit 0fb11be

Browse files
author
Eric Wheeler
committed
Sort output listings by Enclosure and Slot
Before: ENCLOSURE/SLOT DEV FAULT_LED LOCATION_LED ---------------------------------------------------- 0:0:18:0/Slot05 ---- fault_off locate_off 0:0:18:0/Slot23 ---- fault_off locate_off 0:0:18:0/Slot13 ---- fault_off locate_off 0:0:18:0/Slot03 sdh fault_off locate_off 0:0:18:0/Slot21 ---- fault_off locate_off 0:0:18:0/Slot11 sde fault_off locate_off 0:0:18:0/Slot01 sdb fault_off locate_off 0:0:18:0/Slot18 ---- fault_off locate_off 0:0:18:0/Slot08 sdf fault_off locate_off 0:0:18:0/Slot16 ---- fault_off locate_off 0:0:18:0/Slot06 sdg fault_off locate_off 0:0:18:0/Slot14 ---- fault_off locate_off 0:0:18:0/Slot04 ---- fault_off locate_off 0:0:18:0/Slot22 ---- fault_off locate_off 0:0:18:0/Slot12 ---- fault_off locate_off 0:0:18:0/Slot02 sdc fault_off locate_off 0:0:18:0/Slot20 ---- fault_off locate_off 0:0:18:0/Slot10 sdj fault_off locate_off 0:0:18:0/Slot00 sdi fault_off locate_off 0:0:18:0/Slot19 ---- fault_off locate_off 0:0:18:0/Slot09 sdk fault_off locate_off 0:0:18:0/Slot17 ---- fault_off locate_off 0:0:18:0/Slot07 sdl fault_off locate_off 0:0:18:0/Slot15 ---- fault_off locate_off After: ENCLOSURE/SLOT DEV FAULT_LED LOCATION_LED ---------------------------------------------------- 0:0:18:0/Slot00 sdi fault_off locate_off 0:0:18:0/Slot01 sdb fault_off locate_off 0:0:18:0/Slot02 sdc fault_off locate_off 0:0:18:0/Slot03 sdh fault_off locate_off 0:0:18:0/Slot04 ---- fault_off locate_off 0:0:18:0/Slot05 ---- fault_off locate_off 0:0:18:0/Slot06 sdg fault_off locate_off 0:0:18:0/Slot07 sdl fault_off locate_off 0:0:18:0/Slot08 sdf fault_off locate_off 0:0:18:0/Slot09 sdk fault_off locate_off 0:0:18:0/Slot10 sdj fault_off locate_off 0:0:18:0/Slot11 sde fault_off locate_off 0:0:18:0/Slot12 ---- fault_off locate_off 0:0:18:0/Slot13 ---- fault_off locate_off 0:0:18:0/Slot14 ---- fault_off locate_off 0:0:18:0/Slot15 ---- fault_off locate_off 0:0:18:0/Slot16 ---- fault_off locate_off 0:0:18:0/Slot17 ---- fault_off locate_off 0:0:18:0/Slot18 ---- fault_off locate_off 0:0:18:0/Slot19 ---- fault_off locate_off 0:0:18:0/Slot20 ---- fault_off locate_off 0:0:18:0/Slot21 ---- fault_off locate_off 0:0:18:0/Slot22 ---- fault_off locate_off 0:0:18:0/Slot23 ---- fault_off locate_off Signed-off-by: Eric Wheeler <[email protected]>
1 parent 440afc2 commit 0fb11be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

encled

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def main(argv):
210210
return(-1)
211211
print ("ENCLOSURE/SLOT\tDEV\tFAULT_LED\tLOCATION_LED")
212212
print ("-"*52)
213-
for d in devlist:
213+
for d in sorted(devlist, key=lambda x: x[2]):
214214
print_status(d[0], d[1], d[3])
215215
return(0)
216216

@@ -249,7 +249,7 @@ def main(argv):
249249
return(-1)
250250

251251

252-
for dev in devs:
252+
for dev in sorted(devs, key=lambda x: x[2]):
253253
if len(argv) < 3:
254254
print_status(dev[0], dev[1], dev[3])
255255
else:

0 commit comments

Comments
 (0)