Skip to content

Commit f37fe7f

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 dd9299f commit f37fe7f

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
@@ -211,7 +211,7 @@ def main(argv):
211211
return(-1)
212212
print ("ENCLOSURE/SLOT\tDEV\tFAULT_LED\tLOCATION_LED")
213213
print ("-"*52)
214-
for d in devlist:
214+
for d in sorted(devlist, key=lambda x: x[2]):
215215
print_status(d[0], d[1], d[3])
216216
return(0)
217217

@@ -250,7 +250,7 @@ def main(argv):
250250
return(-1)
251251

252252

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

0 commit comments

Comments
 (0)