host information web-based information scripts added
authortausq <>
Thu, 30 Sep 1999 03:38:06 +0000 (03:38 +0000)
committertausq <>
Thu, 30 Sep 1999 03:38:06 +0000 (03:38 +0000)
web/hostinfo.html [new file with mode: 0644]
web/hostinfo.wml [new file with mode: 0644]
web/machines.cgi [new file with mode: 0755]
web/settings.cfg

diff --git a/web/hostinfo.html b/web/hostinfo.html
new file mode 100644 (file)
index 0000000..eea037b
--- /dev/null
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML lang="en">
+<HEAD>
+<TITLE>Debian GNU/Linux -- debian.org Developer Machines</TITLE>
+<LINK REV="made" HREF="mailto:webmaster@debian.org">
+<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<META NAME="Description" CONTENT="Debian GNU/Linux is a free distribution of the GNU/Linux operating system. It is maintained and updated through the work of many users who volunteer their time and effort.">
+<META NAME="Keywords" CONTENT="debian, GNU, linux, unix, open source, free, DFSG ">
+<META NAME="Language" CONTENT="English">
+<meta name="Author"    content="Debian Webmaster, webmaster@debian.org">
+<meta name="Generator" content="WML 1.7.2 (28-06-1999)">
+<meta name="Modified"  content="29-09-1999 22:36:01">
+</HEAD>
+<BODY text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#800080" alink="#FF0000">
+<TABLE border="0" cellpadding="3" cellspacing="0" width="100%">
+<TR>
+<TD>
+<A HREF="http://www.debian.org/logos/" BORDER="0"><IMG src="/Pics/logo-50.jpg" border="0" hspace="0" vspace="0" alt=""></A>
+<IMG src="/Pics/debian.jpg" border="0" hspace="0" vspace="0" alt="Debian Project">
+</TD>
+</TR>
+<TR>
+<TD bgcolor="#DF0451">
+<A href="http://www.debian.org/"><IMG src="/Pics/home.en.gif" border="0" hspace="2" vspace="3" alt="Home"></A>
+<A href="http://www.debian.org/intro/about"><IMG src="/Pics/about.en.gif" border="0" hspace="2" vspace="3" alt="About&nbsp;Debian"></A>
+<A href="http://www.debian.org/News/"><IMG src="/Pics/news.en.gif" border="0" hspace="2" vspace="3" alt="News"></A>
+<A href="http://www.debian.org/distrib/"><IMG src="/Pics/distrib.en.gif" border="0" hspace="2" vspace="3" alt="Distribution"></A>
+<A href="http://www.debian.org/support"><IMG src="/Pics/support.en.gif" border="0" hspace="2" vspace="3" alt="Support"></A>
+<A href="http://www.debian.org/devel/"><IMG src="/Pics/devel.en.gif" border="0" hspace="2" vspace="3" alt="Developers'&nbsp;Corner"></A>
+<A href="http://www.debian.org/search"><IMG src="/Pics/search.en.gif" border="0" hspace="2" vspace="3" alt="Search"></A>
+</TD>
+</TR>
+</TABLE>
+<H1>debian.org Developer Machines</H1>
+<table border="1" width="100%">
+<tr valign="top">
+<td width="20%" align="center">
+<b>Lookup:</b><br>
+<form method="post" action="machines.cgi">
+<select name="host">
+<option value="_summary_">Summary
+~hostlist~
+</select>
+<input type="submit" value="Go">
+</form>
+</td>
+<td>
+&nbsp;<br>
+~hostdetails~
+<br>
+</td>
+</tr></table>
+<HR>
+<P>Back to the <A href="http://www.debian.org/">Debian Project homepage</A>.
+<HR>
+<SMALL>See the Debian <A href="http://www.debian.org/contact">contact page</A> for information on contacting us.
+       
+       
+       
+       
+       
+       
+       
+       
+       
+       
+       </SMALL><P>
+<SMALL>Last Modified: Thu, Sep 30 05:36:01 UTC 1999<BR>
+Copyright &copy; 1997-1999 <A href="http://www.spi-inc.org/">SPI</A>; See <A href="http://www.debian.org/license">license terms</A>
+       
+        </SMALL>
+</BODY>
+</HTML>
diff --git a/web/hostinfo.wml b/web/hostinfo.wml
new file mode 100644 (file)
index 0000000..d9e7f25
--- /dev/null
@@ -0,0 +1,20 @@
+#use wml::debian::template title="debian.org Developer Machines"
+
+<table border=1 width="100%">
+<tr valign="top">
+<td width="20%" align="center">
+<b>Lookup:</b><br>
+<form method="post" action="machines.cgi">
+<select name=host>
+<option value="_summary_">Summary
+~hostlist~
+</select>
+<input type=submit value="Go">
+</form>
+</td>
+<td>
+&nbsp;<br>
+~hostdetails~
+<br>
+</td>
+</tr></table>
diff --git a/web/machines.cgi b/web/machines.cgi
new file mode 100755 (executable)
index 0000000..193eeca
--- /dev/null
@@ -0,0 +1,142 @@
+#!/usr/bin/perl
+
+# (c) 1999 Randolph Chung. Licensed under the GPL. <tausq@debian.org>
+
+use lib '.';
+use strict vars;
+#use Apache::Registry;
+use CGI;
+use Util;
+use Net::LDAP qw(:all);
+
+my (%attrs, @attrorder, %summaryattrs, @summaryorder);
+
+# This defines the description of the fields, and which fields are retrieved
+%attrs = ('hostname' => 'Host name',
+          'admin' => 'Admin contact',
+          'architecture' => 'Architecture',
+          'distribution' => 'Distribution',
+         'access' => 'Access',
+         'sponsor' => 'Sponsor',
+         'sponsorurl' => 'Sponsor URL',
+         'sponsor-admin' => 'Sponsor admin',
+         'location' => 'Location',
+         'machine' => 'Processor',
+         'memory' => 'Memory',
+         'disk' => 'Disk space',
+         'bandwidth' => 'Bandwidth',
+         'notes' => 'Notes',
+         'createtimestamp' => 'Entry created',
+         'modifytimestamp' => 'Entry modified'
+        );
+
+# 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');
+
+# ditto for summary
+%summaryattrs = ('hostname' => 'Host name',
+                 'host'     => 'just for a link',
+                 'architecture' => 'Architecture',
+                'access' => 'Access');
+                
+@summaryorder = ('hostname', 'architecture', 'access');                 
+
+# Global settings...
+my %config = &Util::ReadConfigFile;
+
+my ($ldap, $mesg, $dn, $entries, $data, %output, $key, $hostlist, $hostdetails, $selected, %summary);
+sub DieHandler {
+  $ldap->unbind if (defined($ldap));
+}
+
+$SIG{__DIE__} = \&DieHandler;
+
+my $query = new CGI;
+my $host = lc($query->param('host'));
+
+&Util::HTMLSendHeader;
+$ldap = Net::LDAP->new($config{ldaphost}) || &Util::HTMLError($!);
+$mesg;
+$ldap->bind;
+
+$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)) {
+  $data = $entries->{$dn};
+
+  my $thishost = $data->{host}->[0];
+  $selected = "";
+  
+  if (lc($thishost) eq $host) {
+    $output{havehostdata} = 1;
+
+    foreach $key (keys(%attrs)) {
+      $output{$key} = $data->{$key}->[0];
+    }
+
+    # Modified/created time. TODO: maybe add is the name of the creator/modifier
+    $output{modifytimestamp} = &Util::FormatTimestamp($output{modifytimestamp});
+    $output{createtimestamp}  = &Util::FormatTimestamp($output{createtimestamp});
+    
+    # Format email addresses
+    $output{admin} = sprintf("<a href=\"mailto:%s\">%s</a>", $output{admin}, $output{admin});
+    $output{'sponsor-admin'} = sprintf("<a href=\"mailto:%s\">%s</a>", $output{'sponsor-admin'}, $output{'sponsor-admin'});
+    
+    # URL
+    $output{sponsor} = sprintf("<a href=\"%s\">%s</a>", $output{sponsorurl}, $output{sponsor});   
+    
+    $selected = " selected ";    
+  }
+  
+  $hostlist .= "<option value=\"$thishost\"$selected>$thishost\n";
+  
+  # collect summary info
+  foreach $key (keys(%summaryattrs)) {
+    $summary{$thishost}{$key} = $data->{$key}->[0];
+  }
+  
+  $summary{$thishost}{hostname} = sprintf("<a href=\"machines.cgi?host=%s\">%s</a>",
+                                          $summary{$thishost}{host}, $summary{$thishost}{hostname});
+}
+$ldap->unbind;
+
+if ($output{havehostdata}) {
+  $hostdetails = "<h1>Information about $output{hostname}</h1>\n";
+  $hostdetails .= "<ul>\n";
+  foreach $key (@attrorder) {
+    if ($output{$key}) {
+      $hostdetails .= "<li><b>$key:</b> $output{$key}\n";
+    }
+  }
+  $hostdetails .= "</ul>\n";
+} else {
+  # display summary info
+  $hostdetails = "<h1>Summary</h1>\n";
+  $hostdetails .= "<table border=1 width=90%>\n<th>";
+  foreach $key (@summaryorder) {
+    $hostdetails .= "<td>$summaryattrs{$key}</td>";
+  }
+  $hostdetails .= "</th>\n";
+  
+  foreach $host (sort(keys(%summary))) {
+    $hostdetails .= "<tr>";
+    foreach $key (@summaryorder) {
+      $hostdetails .= "<td>$summary{$host}{$key}&nbsp;</td>";
+    }
+    $hostdetails .= "</tr>\n";
+  }
+  $hostdetails .= "</table>\n";
+}
+
+# Finally, we can write the output... yuck...
+open (F, "<$config{hosthtml}") || &Util::HTMLError("Cannot open host template");
+while (<F>) {
+  s/~hostlist~/$hostlist/;
+  s/~hostdetails~/$hostdetails/;
+  print;
+}
+close F;
index 538f105..440c613 100644 (file)
@@ -2,22 +2,25 @@
 
 ldaphost = "db.debian.org";
 basedn   = "ou=users,dc=debian,dc=org";
+hostbasedn = "ou=hosts,dc=debian,dc=org";
+
+#bughost  = "bugs.debian.org:35567";
+#bugbasedn = "ou=bugs,o=Debian Project,c=US";
+#pkgmaintidx = "pkgmaint.idx";
 
 gpg = "/usr/bin/gpg";
 keyrings = "/usr/share/keyrings/debian-keyring.gpg:/usr/share/keyrings/debian-keyring.pgp";
-tmppath = "/tmp";
 
 webloginhtml = "login.html";
 websearchhtml = "searchform.html";
 websearchresulthtml = "searchresults.html";
 webupdatehtml = "update.html";
+hosthtml = "hostinfo.html";
 
-webloginurl = "debian/login.cgi";
-websearchurl = "debian/search.cgi";
-webupdateurl = "debian/update.cgi";
-
-webmaphtml = "develmaptempl.html";
-xplanetcmd = "xplanet --shade 100 --color white --markers --marker_file [markerfile] --geometry 600x400 --output [outfile]";
+webloginurl = "~randolph/debian/perl/login.cgi";
+websearchurl = "~randolph/debian/perl/search.cgi";
+webupdateurl = "~randolph/debian/perl/update.cgi";
+bugsurl = "~randolph/debian/perl/bugs.cgi";
 
 # When should authentication tokens expire?
 authexpires = 600;