From 9e7a955ba4d460f403cb7557b081a9cbfeb736ef Mon Sep 17 00:00:00 2001 From: tausq <> Date: Thu, 30 Sep 1999 03:38:06 +0000 Subject: [PATCH] host information web-based information scripts added --- web/hostinfo.html | 73 ++++++++++++++++++++++++ web/hostinfo.wml | 20 +++++++ web/machines.cgi | 142 ++++++++++++++++++++++++++++++++++++++++++++++ web/settings.cfg | 17 +++--- 4 files changed, 245 insertions(+), 7 deletions(-) create mode 100644 web/hostinfo.html create mode 100644 web/hostinfo.wml create mode 100755 web/machines.cgi diff --git a/web/hostinfo.html b/web/hostinfo.html new file mode 100644 index 0000000..eea037b --- /dev/null +++ b/web/hostinfo.html @@ -0,0 +1,73 @@ + + + +Debian GNU/Linux -- debian.org Developer Machines + + + + + + + + + + + + + + + + + +
+ +Debian Project +
+Home +About Debian +News +Distribution +Support +Developers' Corner +Search +
+

debian.org Developer Machines

+ + + + +
+Lookup:
+
+ + +
+

+~hostdetails~ +
+
+
+

Back to the Debian Project homepage. +


+See the Debian contact page for information on contacting us. + + + + + + + + + + +

+Last Modified: Thu, Sep 30 05:36:01 UTC 1999
+Copyright © 1997-1999 SPI; See license terms + +
+ + diff --git a/web/hostinfo.wml b/web/hostinfo.wml new file mode 100644 index 0000000..d9e7f25 --- /dev/null +++ b/web/hostinfo.wml @@ -0,0 +1,20 @@ +#use wml::debian::template title="debian.org Developer Machines" + + + + + +
+Lookup:
+
+ + +
+

+~hostdetails~ +
+
diff --git a/web/machines.cgi b/web/machines.cgi new file mode 100755 index 0000000..193eeca --- /dev/null +++ b/web/machines.cgi @@ -0,0 +1,142 @@ +#!/usr/bin/perl + +# (c) 1999 Randolph Chung. Licensed under the GPL. + +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("%s", $output{admin}, $output{admin}); + $output{'sponsor-admin'} = sprintf("%s", $output{'sponsor-admin'}, $output{'sponsor-admin'}); + + # URL + $output{sponsor} = sprintf("%s", $output{sponsorurl}, $output{sponsor}); + + $selected = " selected "; + } + + $hostlist .= "

Information about $output{hostname}

\n"; + $hostdetails .= "\n"; +} else { + # display summary info + $hostdetails = "

Summary

\n"; + $hostdetails .= "\n"; + } + $hostdetails .= "\n"; + + foreach $host (sort(keys(%summary))) { + $hostdetails .= ""; + foreach $key (@summaryorder) { + $hostdetails .= ""; + } + $hostdetails .= "\n"; + } + $hostdetails .= "
"; + foreach $key (@summaryorder) { + $hostdetails .= "$summaryattrs{$key}
$summary{$host}{$key} 
\n"; +} + +# Finally, we can write the output... yuck... +open (F, "<$config{hosthtml}") || &Util::HTMLError("Cannot open host template"); +while () { + s/~hostlist~/$hostlist/; + s/~hostdetails~/$hostdetails/; + print; +} +close F; diff --git a/web/settings.cfg b/web/settings.cfg index 538f105..440c613 100644 --- a/web/settings.cfg +++ b/web/settings.cfg @@ -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; -- 2.20.1