Diff for /loncom/debugging_tools/get_version.pl between versions 1.2 and 1.3

version 1.2, 2006/10/17 15:00:07 version 1.3, 2007/06/06 20:04:47
Line 1 Line 1
 open(HOST,"<$ARGV[0]");  open(HOST,"<$ARGV[0]");
   
   if (!-e 'secure_args') {
       die("Unable to find security arguments for grabbing lon-status");
   }
   
   my $secure_args = `cat secure_args`;
   $secure_args =~ s/^\s*//x;
   $secure_args =~ s/\s*$//x;
 my $i++;  my $i++;
 my %vers;  my %vers;
   my %distvers;
   my %arch;
 my %done;  my %done;
   my %combo1;
   my %combo2;
 while(my $line=<HOST>) {  while(my $line=<HOST>) {
     if ($line=~/^\#/) { next; }      if ($line=~/^\#/) { next; }
     my $host=(split(':',$line))[3];      my $host=(split(':',$line))[3];
     chomp($host);      chomp($host);
     if (!$host || exists($done{$host})) { next; }      if (!$host || exists($done{$host})) { next; }
     $done{$host}=1;      $done{$host}=1;
   
   
       my $roles=`curl --max-time 15 --connect-timeout 5 -s http://$host/adm/login  `;
       if ($roles eq '') {
           $roles=`curl --insecure --max-time 15 --connect-timeout 5 -s https://$host/adm/login `;
       }
   
   #-- lon-capa version
     print($host." -> ");      print($host." -> ");
     my $ver=`curl --max-time 15 --connect-timeout 5 -s http://$host/adm/login | grep -- -200 | tr ">" "\n" | tail -1 `;      my $ver=`curl --max-time 15 --connect-timeout 5 -s http://$host/adm/login | grep -- -200 | tr ">" "\n" | tail -1 `;
     $ver=~s/&nbsp;//g;      $ver=~s/&nbsp;//g;
     $ver=~s/ //g;      $ver=~s/ //g;
     if ($ver eq "") { print("\n"); }      if ($ver eq "") {
    print(" https -> ");
           $ver=`curl --insecure --max-time 15 --connect-timeout 5 -s https://$host/adm/login | grep -- -200 | tr ">" "\n" | tail -1 `;
       }
       $ver=~s/&nbsp;//g;
       $ver=~s/ //g;
       if ($ver eq "") {
    if ($roles eq '') { $ver="dead\n"; } else { $ver = "old\n" }
       }
     print($ver);      print($ver);
     $ver=~s/\s//g;      $ver=~s/\s//g;
     push(@{$vers{$ver}},$host);      push(@{$vers{$ver}},$host);
   
       print(' 'x(length($host)).' -> ');
       my $lonstatus=`curl $secure_args --max-time 15 --connect-timeout 5 -s http://$host/lon-status/ `;
       if ($lonstatus !~ /LON Status Report/) {
    print(" https -> ");
           $lonstatus=`curl --insecure $secure_args --max-time 15 --connect-timeout 5 -s https://$host/lon-status/  `;
       }
       if ($lonstatus =~ /LON Status Report/) {
    print(" lon-status \n");
       }
   
   #-- OS 
       my $dist = $lonstatus;
       print(' 'x(length($host)).' -> ');
       my $re = '.*distprobe.*?<pre>(.*?)</pre>.*';
   #    my $re = '.*?<h1>.*?</h1>.*?<h2>(.*?)</h2>.*';
       if ($dist =~ m{$re}sx) {
    $dist=~s{$re}{$1}sx;
    print($dist);
       } else {
    undef($dist);
       }
   
       print("\n");
       push(@{$distvers{$dist}},$host);
   
   #-- arch
       my $arch = $lonstatus;
       print(' 'x(length($host)).' -> ');
       my $re = '.*?Detected\s+64bit\s+platform\s*\((\d*)\).*';
       if ($arch =~ m{$re}sx) {
    $arch=~s{$re}{$1}sx;
    print($arch);
       } else {
    undef($arch);
       }
       print("\n");
       push(@{$arch{$arch}},$host);
   
       $combo1{"$ver,$dist,$arch"}++;#.=$host.', ';
       $combo2{"$dist,$arch"}++;#.=$host.', ';
   
 #    if ($i++==14) { last; }  #    if ($i++==14) { last; }
 }  }
   print("LON-CAPA Versions\n");
 foreach my $key (sort(keys(%vers))) {  foreach my $key (sort(keys(%vers))) {
     print($key." -> \n");      print($key." -> ".scalar(@{$vers{$key}})." machines\n");
     print("     ".join("\n     ",@{$vers{$key}})."\n");      print("     ".join("\n     ",sort(@{$vers{$key}}))."\n");
   }
   print("OS Versions\n");
   foreach my $key (sort(keys(%distvers))) {
       print($key." -> ".scalar(@{$distvers{$key}})." machines\n");
       print("     ".join("\n     ",sort(@{$distvers{$key}}))."\n");
   }
   print("64bit?\n");
   foreach my $key (sort(keys(%arch))) {
       print($key." -> ".scalar(@{$arch{$key}})." machines\n");
       print("     ".join("\n     ",sort(@{$arch{$key}}))."\n");
   }
   print("Combo 1?\n");
   foreach my $key (sort(keys(%combo1))) {
       print($key." -> ".$combo1{$key}." machines\n");
   }
   print("Combo 2?\n");
   foreach my $key (sort(keys(%combo2))) {
       print($key." -> ".$combo2{$key}." machines\n");
 }  }

Removed from v.1.2  
changed lines
  Added in v.1.3


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