updated with some new features: (copy&pasted from Culus' email)
authortausq <>
Sat, 19 Aug 2000 00:34:11 +0000 (00:34 +0000)
committertausq <>
Sat, 19 Aug 2000 00:34:11 +0000 (00:34 +0000)
  1) hostname now has multiple values, for instance master has
    .debian.org and .ipv6.debian.org. I would like both displayed on the
    top page so people can find the 6bone machines.
  2) Status field will indicate any hardware problems, also on the top
     page if you think it will fit..
  3) Could you sort the pulldown list?
  4) Someone once asked if the distribution could be shown, they were
     looking for a slink box I think. If you think it will fit on the top
     page...

machines.cgi

index 1bca7f8..383f791 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: machines.cgi,v 1.5 2000/01/23 05:36:58 tausq Exp $
+# $Id: machines.cgi,v 1.6 2000/08/19 02:34:11 tausq Exp $
 
 # (c) 1999 Randolph Chung. Licensed under the GPL. <tausq@debian.org>
 
@@ -25,6 +25,7 @@ my (%attrs, @attrorder, %summaryattrs, @summaryorder);
          'memory' => 'Memory',
          'disk' => 'Disk space',
          'bandwidth' => 'Bandwidth',
+         'status' => 'Status',
          'notes' => 'Notes',
          'createtimestamp' => 'Entry created',
          'modifytimestamp' => 'Entry modified'
@@ -33,15 +34,17 @@ my (%attrs, @attrorder, %summaryattrs, @summaryorder);
 # This defines what fields are displayed, and in what order
 @attrorder = ('hostname', 'admin', 'architecture', 'distribution', 'access',
               'sponsor', 'sponsor-admin', 'location', 'machine', 'memory',
-             'disk', 'bandwidth', 'notes', 'createtimestamp', 'modifytimestamp');
+             'disk', 'bandwidth', 'status', 'notes', 'createtimestamp', 'modifytimestamp');
 
 # ditto for summary
 %summaryattrs = ('hostname' => 'Host name',
                  'host'     => 'just for a link',
                  'architecture' => 'Architecture',
+                'distribution' => 'Distribution',
+                'status' => 'Status',
                 'access' => 'Access');
                 
-@summaryorder = ('hostname', 'architecture', 'access');                 
+@summaryorder = ('hostname', 'architecture', 'distribution', 'status', 'access');               
 
 # Global settings...
 my %config = &Util::ReadConfigFile;
@@ -65,7 +68,7 @@ $mesg = $ldap->search(base  => $config{hostbasedn}, filter => 'host=*');
 $mesg->code && &Util::HTMLError($mesg->error);
 $entries = $mesg->as_struct;
 
-foreach $dn (sort {$entries->{$a}->{host}->[0] <=> $entries->{$b}->{host}->[0]} keys(%$entries)) {
+foreach $dn (sort {$entries->{$a}->{host}->[0] cmp $entries->{$b}->{host}->[0]} keys(%$entries)) {
   $data = $entries->{$dn};
 
   my $thishost = $data->{host}->[0];
@@ -111,8 +114,10 @@ foreach $dn (sort {$entries->{$a}->{host}->[0] <=> $entries->{$b}->{host}->[0]}
     $summary{$thishost}{$key} = $data->{$key}->[0];
   }
   
-  $summary{$thishost}{hostname} = sprintf("<a href=\"machines.cgi?host=%s\">%s</a>",
-                                          $summary{$thishost}{host}, $summary{$thishost}{hostname});
+  $summary{$thishost}{hostname} = undef;
+  foreach my $hostname (@{$data->{hostname}}) {
+    $summary{$thishost}{hostname} .= sprintf("%s<a href=\"machines.cgi?host=%s\">%s</a>", ($summary{$thishost}{hostname} ? ', ' : ''), $summary{$thishost}{host}, $hostname);
+  }
 }
 $ldap->unbind;