]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
HostnameSortSwapWords: Make name order mangling configurable
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 13 Mar 2015 15:19:43 +0000 (15:19 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 24 Mar 2015 19:00:05 +0000 (19:00 +0000)
We still default to having the mangling enabled.  Arguably this is
wrong I'm am minimising the number of things that will be wrong for
the existing Cambridge instance.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest.pm
mg-hosts
ms-planner

index 9fbadbdd2016ebcd712804f640f0d6cf97304b54..5854257e8f24c5b71188dfd46d4824d6d9c40105 100644 (file)
@@ -73,6 +73,8 @@ our %c = qw(
     Baud  115200
 
     DebianNonfreeFirmware firmware-bnx2
+
+    HostnameSortSwapWords 1
 );
 
 $c{$_}='' foreach qw(
index 497139a988a1d234f43ee9491c2e6342b6ba374a..a911099c0d7c3dec213c1479d3e3ed985c524009 100755 (executable)
--- a/mg-hosts
+++ b/mg-hosts
@@ -439,9 +439,10 @@ END
 
 sub cmd_showflags () {
     die if @ARGV;
+    my $sortkey = !$c{HostnameSortSwapWords} ? "hostname"
+       : "split_part(hostname, '-', 2), hostname";
     my $hostsq= $dbh_tests->prepare(<<END);
-        SELECT hostname FROM hostflags ORDER BY
-            split_part(hostname, '-', 2), hostname
+        SELECT hostname FROM hostflags ORDER BY $sortkey
 END
     my $findq= $dbh_tests->prepare(<<END);
         SELECT * FROM hostflags ORDER BY hostflag
index f045bbf4ea27fa8e44bda1f10cbb9083827838e8..1dd01a95ba829a61f1e06759faf46f0054551698 100755 (executable)
@@ -563,7 +563,9 @@ sub cmd_show_html () {
        } @{ $plan->{Events}{$reso} } ];
     }
 
-    my $colheadsortkey= sub { ($_[0] =~ m/-/ ? "$' $`" : "").$_[0]; };
+    my $colheadsortkey=
+       !$c{HostnameSortSwapWords} ? sub { $_[0]; }
+        : sub { ($_[0] =~ m/-/ ? "$' $`" : "").$_[0]; };
     my @colheads = sort {
         $colheadsortkey->($a) cmp $colheadsortkey->($b)
     } keys %{ $plan->{Events} };