From 9cd3fac6682b8c5c9e7e656cc5e195525f3d5525 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 28 Aug 2017 10:49:36 -0400 Subject: [PATCH] Make rinv output sorted deterministically The numeric sort was throwing up it's hands on pure text keys. Fix by adding an 'or cmp' to try string comparison if numerical sort counts them as equal. --- xCAT-server/lib/xcat/plugins/ipmi.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index c43d780b0..5c2fb6b54 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2959,7 +2959,7 @@ sub fru_initted { my @types = @{ $sessdata->{invtypes} }; my $format = "%-20s %s"; - foreach $key (sort { $a <=> $b } keys %{ $sessdata->{fru_hash} }) { + foreach $key (sort { $a <=> $b or $a cmp $b } keys %{ $sessdata->{fru_hash} }) { my $fru = $sessdata->{fru_hash}->{$key}; my $type; foreach $type (split /,/, $fru->rec_type) {