[LON-CAPA-cvs] cvs: loncom /debugging_tools get_version.pl

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 14 Aug 2006 19:53:02 -0000


albertel		Mon Aug 14 15:53:02 2006 EDT

  Added files:                 
    /loncom/debugging_tools	get_version.pl 
  Log:
  - adding version tracking helper
  
  

Index: loncom/debugging_tools/get_version.pl
+++ loncom/debugging_tools/get_version.pl
open(HOST,"<$ARGV[0]");
my $i++;
my %vers;
my %done;
while(my $line=<HOST>) {
    if ($line=~/^\#/) { next; }
    my $host=(split(':',$line))[3];
    chomp($host);
    if (!$host || exists($done{$host})) { next; }
    $done{$host}=1;
    print($host." -> ");
    my $ver=`curl --connect-timeout 5 -s http://$host/adm/roles | grep -- -200 | tr ">" "\n" | tail -1 `;
    $ver=~s/&nbsp;//g;
    $ver=~s/ //g;
    if ($ver eq "") { print("\n"); }
    print($ver);
    $ver=~s/\s//g;
    push(@{$vers{$ver}},$host);
#    if ($i++==14) { last; }
}

foreach my $key (sort(keys(%vers))) {
    print($key." -> \n");
    print("     ".join("\n     ",@{$vers{$key}})."\n");
}