[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 26/32] HostnameSortSwapWords: Make name order mangling configurable



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@xxxxxxxxxxxxx>
---
 Osstest.pm |    2 ++
 mg-hosts   |    5 +++--
 ms-planner |    4 +++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Osstest.pm b/Osstest.pm
index 9fbadbd..5854257 100644
--- a/Osstest.pm
+++ b/Osstest.pm
@@ -73,6 +73,8 @@ our %c = qw(
     Baud  115200
 
     DebianNonfreeFirmware firmware-bnx2
+
+    HostnameSortSwapWords 1
 );
 
 $c{$_}='' foreach qw(
diff --git a/mg-hosts b/mg-hosts
index 497139a..a911099 100755
--- 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
diff --git a/ms-planner b/ms-planner
index f045bbf..1dd01a9 100755
--- a/ms-planner
+++ b/ms-planner
@@ -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} };
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.