2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-22 11:10:24 +00:00

Merge pull request #3703 from mattaezell/switch_macmap_natural_sort

Sort 'xcatprobe switch_macmap' ports in 'natural' order
This commit is contained in:
zet809
2017-08-17 13:34:05 +08:00
committed by GitHub

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