From 45df02f4f3bc899da51f6adb7db891713f4f279d Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Wed, 16 Aug 2017 21:08:52 -0400 Subject: [PATCH] Sort 'xcatprobe switch_macmap' ports in 'natural' order Old: swp1,swp11,swp12,swp2,swp20,swp21 New: swp1,swp2,swp11,swp12,swp20,swp21 --- xCAT-server/lib/xcat/plugins/switch.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/switch.pm b/xCAT-server/lib/xcat/plugins/switch.pm index dff93d270..523932036 100644 --- a/xCAT-server/lib/xcat/plugins/switch.pm +++ b/xCAT-server/lib/xcat/plugins/switch.pm @@ -251,7 +251,7 @@ sub process_request { $cb->({ node => [ { name => $switch, data => ["PASS"] } ] }); next; } - foreach my $port (sort keys %{ $macinfo->{$switch} }) { + foreach my $port (map{$_->[0]}sort{$a->[1] cmp $b->[1] || $a->[2] <=> $b->[2]}map{[$_, /^(.*?)(\d+)?$/]} keys %{ $macinfo->{$switch} }) { my $node = ''; if (defined($macinfo->{$switch}->{$port}->{Node})) { $node = $macinfo->{$switch}->{$port}->{Node};