[LON-CAPA-cvs] cvs: doc /loncapafiles sanitycheck.piml updatequery.piml

raeburn raeburn@source.lon-capa.org
Wed, 21 Jul 2010 00:32:45 -0000


This is a MIME encoded message

--raeburn1279672365
Content-Type: text/plain

raeburn		Wed Jul 21 00:32:45 2010 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml sanitycheck.piml 
  Log:
  - Internet domain for institution (e.g., msu.edu) included as an additional item to specify for hosts.tab when updating/installing LON-CAPA.
  
  
--raeburn1279672365
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20100721003245.txt"

Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.64 doc/loncapafiles/updatequery.piml:1.65
--- doc/loncapafiles/updatequery.piml:1.64	Fri Jan  1 04:29:01 2010
+++ doc/loncapafiles/updatequery.piml	Wed Jul 21 00:32:44 2010
@@ -1,6 +1,6 @@
 <!-- updatequery.piml -->
 
-<!-- $Id: updatequery.piml,v 1.64 2010/01/01 04:29:01 raeburn Exp $ -->
+<!-- $Id: updatequery.piml,v 1.65 2010/07/21 00:32:44 raeburn Exp $ -->
 
 <!--
 
@@ -125,6 +125,7 @@
 my $domainTabExtras;
 my $primaryLibServer;
 my $protocol;
+my $intdom;
 my @libservers = ();
 unless (-e "<TARGET />") {
   print(&lt;&lt;END);
@@ -486,7 +487,7 @@
 
   my $choice=&lt;&gt;;
   chomp($choice);
-  if ($choice!~/^https?$/) {
+  if ($choice =~ /^https?$/) {
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
     print(OUT 'protocol'."\t".$choice."\n");
     close(OUT);
@@ -498,6 +499,35 @@
   }
 }
 
+while (!$flag) {
+  print(&lt;&lt;END);
+
+****  Internet Domain Name of Your Institution ****
+
+The internet domain name used for servers at your institution 
+should be provided.  This will be similar to: ustate.edu or
+topcollege.ac.uk or my.hostingcompany.com, i.e., the part of
+a server hostname which indicates to which organization the 
+server belongs.
+
+ENTER INTERNET DOMAIN NAME:
+END
+
+  my $choice=&lt;&gt;;
+  chomp($choice);
+  if ($choice =~/[^.]+\.[^.]+/) {
+    open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
+    print(OUT 'internet domain'."\t".$intdom."\n");
+    close(OUT);
+    $intdom=$choice;
+    $flag=1;
+  }
+  else {
+    print "Invalid input (must be at least two levels separated by .  - e.g., ustate.edu).\n";
+  }
+}
+
+
 # update loncapa.conf
 my $confdir = '/etc/httpd/conf/';
 if ('<DIST />' eq 'sles10' || '<DIST />' eq 'sles11' || '<DIST />' eq 'suse10.1' || '<DIST />' eq 'suse10.2' || '<DIST />' eq 'suse10.3' || '<DIST />' eq 'suse11.1' || '<DIST />' eq 'suse11.2' || '<DIST />' eq 'debian5' || '<DIST />' eq 'ubuntu6' || '<DIST />' eq 'ubuntu8') {
@@ -676,6 +706,18 @@
         $protocol = 'http';
     }
 
+    if (!$intdom) {
+        foreach my $file (@hosts_files) {
+            open(IN,'&lt;'.$file);
+            while(my $line = &lt;IN&gt;) {
+                if ($line =~ /^\Q$perlvar{'lonHostID'}\E:\Q$perlvar{'lonDefDomain'}\E\:(?:access|library)\:https?:([^:]+)/) {
+                    $intdom = $1;
+                    last;
+                }
+            }
+        }
+    }
+
     while(!$primaryLibServ && (@hosts_file || @domain_files)) {
 	my $file = shift(@domain_files);
         open(IN,'&lt;'.$file);
@@ -703,7 +745,7 @@
     }
    
 # implement editing logic below, interactively
-# update loncapa.conf until 13 is entered
+# update loncapa.conf until 14 is entered
 
 $flag=0;
 
@@ -719,12 +761,13 @@
  5) Server Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
  6) Support E-mail Address: $perlvar{'lonSupportEMail'}
  7) Web Server Protocol (http or https): $protocol 
- 8) Role: $perlvar{'lonRole'}
- 9) Cache Expiration Time: $perlvar{'lonExpire'}
-10) Server Load: $perlvar{'lonLoadLim'}
-11) User Load: $perlvar{'lonUserLoadLim'}
-12) Allow only secure connections: $securestatus 
-13) Everything is correct up above
+ 8) Internet Domain Name: $intdom 
+ 9) Role: $perlvar{'lonRole'}
+10) Cache Expiration Time: $perlvar{'lonExpire'}
+11) Server Load: $perlvar{'lonLoadLim'}
+12) User Load: $perlvar{'lonUserLoadLim'}
+13) Allow only secure connections: $securestatus 
+14) Everything is correct up above
 END
 
 my @error;
@@ -759,6 +802,12 @@
    push(@error,"Invalid Protocol (must be http or https");
 }
 
+if (!defined($intdom)) { 
+   push(@error,"No internet domain name designated. Enter something like ustate.edu"); 
+} elsif ($intdom !~ /^[^.]+\.\w{2,6}$/) {
+   push(@error,"Invalid Internet domain name (must be at least two levels separated by .  - e.g., ustate.edu");
+}
+
 if (!defined($primaryLibServer)) {
    if (@libservers > 0) {
        push(@error,"No primary library server ID designated. Choose from: ".join(',',sort(@libservers)));
@@ -784,7 +833,7 @@
 
 if (@error) { print "\n*** ERRORS: \n\t".join("\n\t",@error)."\n"; }
   print(&lt;&lt;END);
-ENTER A CHOICE OF 1-12 TO CHANGE, otherwise ENTER 13:
+ENTER A CHOICE OF 1-13 TO CHANGE, otherwise ENTER 14:
 END
 my $choice=&lt;&gt;;
 chomp($choice);
@@ -866,7 +915,17 @@
   }
   elsif ($choice==8) {
   print(&lt;&lt;END);
-8) Role: $perlvar{'lonRole'}
+8) Internet Domain Name of Institution
+ENTER NEW VALUE: 
+
+END
+    my $choice2=&lt;&gt;;
+    chomp($choice2);
+    $intdom=$choice2;
+  }
+  elsif ($choice==9) {
+  print(&lt;&lt;END);
+9) Role: $perlvar{'lonRole'}
 ENTER NEW VALUE (this should be either 'access' or 'library' 
                  if in doubt select 'library'):
 END
@@ -874,27 +933,27 @@
     chomp($choice2);
     $perlvar{'lonRole'}=$choice2;
   }
-  elsif ($choice==9) {
+  elsif ($choice==10) {
   print(&lt;&lt;END);
-9) Cache Expiration Time: $perlvar{'lonExpire'}
+10) Cache Expiration Time: $perlvar{'lonExpire'}
 ENTER NEW VALUE (in seconds, 86400 is a reasonable value):
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
     $perlvar{'lonExpire'}=$choice2;
   }
-  elsif ($choice==10) {
+  elsif ($choice==11) {
   print(&lt;&lt;END);
-10) Server Load: $perlvar{'lonLoadLim'}
+11) Server Load: $perlvar{'lonLoadLim'}
 ENTER NEW VALUE:
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
     $perlvar{'lonLoadLim'}=$choice2;
   }
-  elsif ($choice==11) {
+  elsif ($choice==12) {
   print(&lt;&lt;END);
-11) User Load: $perlvar{'lonUserLoadLim'}
+12) User Load: $perlvar{'lonUserLoadLim'}
 Numer of users that can login before machine is 'overloaded'
 ENTER NEW VALUE (integer value, 0 means there is no limit):
 END
@@ -902,9 +961,9 @@
     chomp($choice2);
     $perlvar{'lonUserLoadLim'}=$choice2;
   }
-  elsif ($choice==12) {
+  elsif ($choice==13) {
   print(&lt;&lt;END);
-12) Allow only secure connections: $securestatus 
+13) Allow only secure connections: $securestatus 
 The Lon-CAPA communication daemons lonc and lond can be configured to
 allow only secure connections by default.
 
@@ -931,7 +990,7 @@
     }
     ($securestatus,$securenum)=&securesetting(%perlvar);
   }
-  elsif (($choice==13) && (!$error)) {
+  elsif (($choice==14) && (!$error)) {
     $flag=1;
   }
   else {
@@ -964,7 +1023,7 @@
   $lineexistflag=0;
   $hostidexistflag=0;
   $line2insert=&lt;&lt;END;
-$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$protocol
+$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$protocol:$intdom
 END
   if (!$domainTabExtras) {
 	$domainTabExtras=':::::';
@@ -1018,7 +1077,7 @@
        close(OUT);
       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
       # email appropriate message
-      `echo "REPLACE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "REPLACE:$lonCluster:$lonHostID:$protocol:$date" installrecord\@mail.lon-capa.org`;
+      `echo "REPLACE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "REPLACE:$lonCluster:$lonHostID:$protocol:$intdom:$date" installrecord\@mail.lon-capa.org`;
     }
     elsif ($hostidexistflag and $lineexistflag) {
       print &lt;&lt;END;
@@ -1031,7 +1090,7 @@
        close(OUT);
       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
       # email appropriate message
-      `echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$protocol:$date" installrecord\@mail.lon-capa.org`;
+      `echo "STABLEUPDATE:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "STABLEUPDATE:$lonCluster:$lonHostID:$protocol:$intdom:$date" installrecord\@mail.lon-capa.org`;
     }
     elsif (!$hostidexistflag and !$lineexistflag) {
       print &lt;&lt;END;
@@ -1044,7 +1103,7 @@
        close(OUT);
       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
       # email appropriate message
-      `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$protocol:$date" installrecord\@mail.lon-capa.org`;
+      `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$protocol:$intdom:$date" installrecord\@mail.lon-capa.org`;
     }
   }
   $lineexistflag=0;
Index: doc/loncapafiles/sanitycheck.piml
diff -u doc/loncapafiles/sanitycheck.piml:1.32 doc/loncapafiles/sanitycheck.piml:1.33
--- doc/loncapafiles/sanitycheck.piml:1.32	Tue May  4 01:45:31 2010
+++ doc/loncapafiles/sanitycheck.piml	Wed Jul 21 00:32:44 2010
@@ -2,7 +2,7 @@
 	"http://lpml.sourceforge.net/DTD/piml.dtd">
 <!-- sanitycheck.piml -->
 
-<!-- $Id: sanitycheck.piml,v 1.32 2010/05/04 01:45:31 raeburn Exp $ -->
+<!-- $Id: sanitycheck.piml,v 1.33 2010/07/21 00:32:44 raeburn Exp $ -->
 
 <!--
 
@@ -169,7 +169,7 @@
       $a[1]=~/[^\w\-.]/ ||
       $a[0]=~/\_/       ||
       $a[1]=~/\_/      ) { $dbug=1; push(@{$line{'d'}},$line); }
-  if (@a<4 || @a>5) {      $fbug=1; push(@{$line{'f'}},$line); }
+  if (@a<6 || @a>6) {      $fbug=1; push(@{$line{'f'}},$line); }
   my $expr='\s.+$';
   if ($a[0] =~ /$expr/ ||
       $a[1] =~ /$expr/ ||
@@ -186,7 +186,7 @@
   print "**** ERROR **** <TARGET /> has invalid host id or domain id (lines ".join(', ',@{$line{'d'}}).")\n";
 }
 if ($fbug) {
-  print "**** ERROR **** <TARGET /> is lacking 4 or 5 columns for every row (lines ".join(', ',@{$line{'f'}}).")\n";
+  print "**** ERROR **** <TARGET /> is lacking 6 columns for every row (lines ".join(', ',@{$line{'f'}}).")\n";
 }
 if ($sbug) {
   print "**** ERROR **** <TARGET /> has illegal whitespace character (lines ".join(', ',@{$line{'s'}}).")\n";

--raeburn1279672365--