2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-07-24 05:11:12 +00:00

Sort 'xcatprobe switch_macmap' ports in 'natural' order

Old: swp1,swp11,swp12,swp2,swp20,swp21
New: swp1,swp2,swp11,swp12,swp20,swp21
This commit is contained in:
Matt Ezell
2017-08-16 21:08:52 -04:00
parent feb51eb6a6
commit 45df02f4f3

View File

@@ -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};