Annotation of loncom/production_dns_sanity.pl, revision 1.1

1.1     ! www         1: use strict;
        !             2: my %domserv=();
        !             3: my %domname=();
        !             4: my %hostdom=();
        !             5: my %hostfunc=();
        !             6: 
        !             7: # Read the tables
        !             8: 
        !             9: open(IN,"production_dns_domain.tab");
        !            10: while (my $line=<IN>) {
        !            11:    if ($line=~/^\s*\#/) { next; }
        !            12:    chomp($line);
        !            13:    unless ($line=~/\S/) { next; }
        !            14:    my ($domain,$name,$auth,$authparm,$lang,$city,$coord1,$coord2,$lib)=split(/\:/,$line);
        !            15:    $domserv{$domain}=$lib;
        !            16:    $domname{$domain}=$name;
        !            17: }
        !            18: close(IN);
        !            19: open(IN,"production_dns_hosts.tab");
        !            20: while (my $line=<IN>) {
        !            21:    if ($line=~/^\s*\#/) { next; }
        !            22:    chomp($line);
        !            23:    unless ($line=~/\S/) { next; }
        !            24:    my ($server,$domain,$function,$ip)=split(/\:/,$line);
        !            25:    if ($hostdom{$server}) {
        !            26:       print "$server defined more than once in hosts.tab\n";
        !            27:    }
        !            28:    $hostdom{$server}=$domain;
        !            29:    $hostfunc{$server}=$function;
        !            30: }
        !            31: close(IN);
        !            32: 
        !            33: # Every mentioned library server should be in hosts.tab
        !            34: 
        !            35: foreach my $dom (keys %domserv) {
        !            36:     unless ($hostdom{$domserv{$dom}} eq $dom) {
        !            37:        print "Did not find $domserv{$dom} in hosts.tab\n";
        !            38:     }
        !            39:     unless ($hostfunc{$domserv{$dom}} eq 'library') {
        !            40:        print "$domserv{$dom} is not a library server ($hostfunc{$domserv{$dom}})\n";
        !            41:     }
        !            42: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>