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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 09 Dec 2002 18:37:15 -0000


albertel		Mon Dec  9 13:37:15 2002 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  - attempting to fix BUG#1034, still doesn't pick up old values from existing hosts.tab files
  - doesn't actually set the value
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.19 doc/loncapafiles/updatequery.piml:1.20
--- doc/loncapafiles/updatequery.piml:1.19	Sun Sep  8 19:57:51 2002
+++ doc/loncapafiles/updatequery.piml	Mon Dec  9 13:37:15 2002
@@ -1,7 +1,7 @@
 <!-- updatequery.piml -->
 <!-- Scott Harrison -->
 
-<!-- $Id: updatequery.piml,v 1.19 2002/09/08 23:57:51 harris41 Exp $ -->
+<!-- $Id: updatequery.piml,v 1.20 2002/12/09 18:37:15 albertel Exp $ -->
 
 <!--
 
@@ -55,6 +55,7 @@
 <target dist='default'>/home/httpd/lonTabs/hosts.tab</target>
 <perlscript mode='fg'>
 $|=1;
+my $domainDescription;
 unless (-e "<TARGET />") {
   print(&lt;&lt;END);
            WELCOME TO LON-CAPA!
@@ -175,6 +176,34 @@
   }
 }
 
+
+# get domain description
+# accept if valid, if not valid, tell user and repeat
+$flag=0;
+
+while (!$flag) {
+  print(&lt;&lt;END);
+
+**** Domain Description ****
+String describing the domain, to be shown to users.
+[Example, msu is Michigan State University]
+ENTER DOMAIN DESCRIPTION:
+END
+
+  my $choice=&lt;&gt;;
+  chomp($choice);
+  if ($choice!~/:/) {
+    open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
+    print(OUT 'domainDescription'."\t".$choice."\n");
+    close(OUT);
+    $domainDescription=$choice;
+    $flag=1;
+  }
+  else {
+    print "Invalid input (no ':' allowed).\n";
+  }
+}
+
 my $lonHostID;
 if ($lonDefDomain) {
   $lonHostID=$lonDefDomain.$r.int(1+rand(9)); # should be probably also detect
@@ -358,12 +387,13 @@
 ===============================================================================
 This is now the current configuration of your machine.
 1) Domain Name: $perlvar{'lonDefDomain'}
-2) Machine Name: $perlvar{'lonHostID'}
-3) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
-4) Role: $perlvar{'lonRole'}
-5) Cache Expiration Time: $perlvar{'lonExpire'}
-6) Server Load: $perlvar{'lonLoadLim'}
-7) Everything is correct up above
+2) Domain Description: $domainDescription
+3) Machine Name: $perlvar{'lonHostID'}
+4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
+5) Role: $perlvar{'lonRole'}
+6) Cache Expiration Time: $perlvar{'lonExpire'}
+7) Server Load: $perlvar{'lonLoadLim'}
+8) Everything is correct up above
 END
 my $hbug=-1;
 my $dbug=-1;
@@ -390,14 +420,17 @@
 }
 
   print(&lt;&lt;END);
-ENTER A CHOICE OF 1-6 TO CHANGE, otherwise ENTER 7:
+ENTER A CHOICE OF 1-7 TO CHANGE, otherwise ENTER 8:
 END
 my $choice=&lt;&gt;;
 chomp($choice);
   if ($choice==1) {
   print(&lt;&lt;END);
 1) Domain Name: $perlvar{'lonDefDomain'}
-ENTER NEW VALUE:
+ENTER NEW VALUE (this is an internal value used to identify a group of
+                 LON-CAPA machines, it must be alphanumerical, we suggest
+                 using a part of your actual DNS domain. For example, for
+                 the machine loncapa.msu.edu, we set the Domain to msu):
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
@@ -405,50 +438,64 @@
   }
   elsif ($choice==2) {
   print(&lt;&lt;END);
-2) Machine Name: $perlvar{'lonHostID'}
-ENTER NEW VALUE:
+2) Domain Description: $domainDescription
+ENTER NEW VALUE (this should be a string that describes your domain, spaces
+                 and punctuation are fine except for ':'):
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
-    $perlvar{'lonHostID'}=$choice2;
+    $domainDescription=$choice2;
   }
   elsif ($choice==3) {
   print(&lt;&lt;END);
-3) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
-ENTER NEW VALUE:
+3) Machine Name: $perlvar{'lonHostID'}
+ENTER NEW VALUE (this will be the name of the machine in the LON-CAPA network
+                 it cannot contain any of '_' '-' '.' or ':'. We suggest that
+                 if you are in the domain 'example' and are the first library
+                 server you enter 'examplel1') :
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
-    $perlvar{'lonAdmEMail'}=$choice2;
+    $perlvar{'lonHostID'}=$choice2;
   }
   elsif ($choice==4) {
   print(&lt;&lt;END);
-4) Role: $perlvar{'lonRole'}
+4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
 ENTER NEW VALUE:
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
-    $perlvar{'lonRole'}=$choice2;
+    $perlvar{'lonAdmEMail'}=$choice2;
   }
   elsif ($choice==5) {
   print(&lt;&lt;END);
-5) Cache Expiration Time: $perlvar{'lonExpire'}
-ENTER NEW VALUE:
+5) Role: $perlvar{'lonRole'}
+ENTER NEW VALUE (this should be either 'access' or 'library' 
+                 if in doubt select 'library'):
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
-    $perlvar{'lonExpire'}=$choice2;
+    $perlvar{'lonRole'}=$choice2;
   }
   elsif ($choice==6) {
   print(&lt;&lt;END);
-6) Server Load: $perlvar{'lonLoadLim'}
+6) 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==7) {
+  print(&lt;&lt;END);
+7) Server Load: $perlvar{'lonLoadLim'}
 ENTER NEW VALUE:
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
     $perlvar{'lonLoadLim'}=$choice2;
   }
-  elsif ($choice==7) {
+  elsif ($choice==8) {
     $flag=1;
   }
   else {
@@ -559,6 +606,7 @@
        open(OUT,'&gt;&gt;../new_'.$lonCluster.'_hosts.tab') or
          die("cannot open loncom/${lonCluster}_hosts.tab for output\n");
          print(OUT $line2insert);
+	print($line2insert);
        close(OUT);
       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
       # email appropriate message