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

harris41 lon-capa-cvs@mail.lon-capa.org
Mon, 13 May 2002 17:56:29 -0000


harris41		Mon May 13 13:56:29 2002 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  fixing persistence of lonHostID user entry; asking for lonDefDomain BEFORE
  asking for lonHostID; BUG 432
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.7 doc/loncapafiles/updatequery.piml:1.8
--- doc/loncapafiles/updatequery.piml:1.7	Mon May 13 05:05:18 2002
+++ doc/loncapafiles/updatequery.piml	Mon May 13 13:56:29 2002
@@ -1,7 +1,7 @@
 <!-- updatequery.piml -->
 <!-- Scott Harrison -->
 
-<!-- $Id: updatequery.piml,v 1.7 2002/05/13 09:05:18 harris41 Exp $ -->
+<!-- $Id: updatequery.piml,v 1.8 2002/05/13 17:56:29 harris41 Exp $ -->
 
 <!--
 
@@ -52,7 +52,7 @@
 </perlscript>
 </file>
 <file>
-<target dist='default'>/home/httpd/lonUsers/</target>
+<target dist='default'>/home/httpd/lonUsers2/</target>
 <perlscript mode='fg'>
 $|=1;
 unless (-e "<TARGET />") {
@@ -65,8 +65,8 @@
 ===============================================================================
 The following 4 values are needed to configure LON-CAPA:
 * Machine Role
-* Machine ID Name
-* LON-CAPA Domain Name, and
+* LON-CAPA Domain Name
+* LON-CAPA Machine ID Name, and
 * System Administration E-mail Address.
 END
 
@@ -120,48 +120,45 @@
 if ($hostname=~/([^\.]*)\.([^\.]*)$/) {
   $ipdomain=$1;
 }
-my $lonHostID;
-if ($ipdomain) {
-  $lonHostID=$ipdomain.$r.int(1+rand(9)); # should be probably detect against
-                                          # the hosts.tab
-}
 
   print(&lt;&lt;END);
 
-**** Machine ID Name ****
-[this does NOT need to correspond to internet address names;
- this name MUST be unique to the whole LON-CAPA network;
- we recommend that you use a name based off of your institution;
- good examples: "msul1" or "bionetl1";
- bad examples: "loncapabox" or "studentsinside"]
+**** Domain ****
+[this does NOT need to correspond to internet address domains,
+ examples might be "msu" or "bionet" or "vermontcc"]
 END
-# get machine name
+
+# get domain name
 # accept if valid, if not valid, tell user and repeat
 $flag=0;
+my $lonDefDomain;
 while (!$flag) {
 if ($ipdomain) {
 print(&lt;&lt;END);
-ENTER LONCAPA MACHINE ID [$lonHostID]:
+ENTER LONCAPA DOMAIN [$ipdomain]:
 END
 }
 else {
   print(&lt;&lt;END);
-ENTER LONCAPA MACHINE ID:
+ENTER LONCAPA DOMAIN:
 END
 }
   my $choice=&lt;&gt;;
   chomp($choice);
-  if ($lonHostID and $choice=~/^\s*$/) {
-    $choice=$lonHostID;
+  if ($ipdomain and $choice=~/^\s*$/) {
+    $choice=$ipdomain;
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
-    print(OUT 'lonHostID'."\t".$choice."\n");
+    print(OUT 'lonDefDomain'."\t".$choice."\n");
     close(OUT);
+    $lonDefDomain=$choice;
     $flag=1;
   }
   elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
-    print(OUT 'lonHostID'."\t".$choice."\n");
+    print(OUT 'lonDefDomain'."\t".$choice."\n");
     close(OUT);
+    $lonDefDomain=$choice;
+    $r='l';
     $flag=1;
   }
   else {
@@ -169,44 +166,50 @@
   }
 }
 
+my $lonHostID;
+if ($lonDefDomain) {
+  $lonHostID=$lonDefDomain.$r.int(1+rand(9)); # should be probably also detect
+                                              # against the hosts.tab
+}
+
   print(&lt;&lt;END);
 
-**** Domain ****
-[this does NOT need to correspond to internet address domains,
- examples might be "msu" or "bionet" or "vermontcc"]
+**** Machine ID Name ****
+[this does NOT need to correspond to internet address names;
+ this name MUST be unique to the whole LON-CAPA network;
+ we recommend that you use a name based off of your institution;
+ good examples: "msul1" or "bionetl1";
+ bad examples: "loncapabox" or "studentsinside"]
 END
-
-# get domain name
+# get machine name
 # accept if valid, if not valid, tell user and repeat
 $flag=0;
-my $lonDefDomain;
 while (!$flag) {
 if ($ipdomain) {
 print(&lt;&lt;END);
-ENTER LONCAPA DOMAIN [$ipdomain]:
+ENTER LONCAPA MACHINE ID [$lonHostID]:
 END
 }
 else {
   print(&lt;&lt;END);
-ENTER LONCAPA DOMAIN:
+ENTER LONCAPA MACHINE ID:
 END
 }
   my $choice=&lt;&gt;;
   chomp($choice);
-  if ($ipdomain and $choice=~/^\s*$/) {
-    $choice=$ipdomain;
+  if ($lonHostID and $choice=~/^\s*$/) {
+    $choice=$lonHostID;
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
-    print(OUT 'lonDefDomain'."\t".$choice."\n");
+    print(OUT 'lonHostID'."\t".$choice."\n");
     close(OUT);
-    $lonDefDomain=$choice;
+    $lonHostID=$choice;
     $flag=1;
   }
   elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
-    print(OUT 'lonDefDomain'."\t".$choice."\n");
+    print(OUT 'lonHostID'."\t".$choice."\n");
     close(OUT);
-    $lonDefDomain=$choice;
-    $r='l';
+    $lonHostID=$choice;
     $flag=1;
   }
   else {
@@ -333,8 +336,8 @@
 
 ===============================================================================
 This is now the current configuration of your machine.
-1) Machine Name: $perlvar{'lonHostID'}
-2) Domain Name: $perlvar{'lonDefDomain'}
+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'}
@@ -348,21 +351,21 @@
 chomp($choice);
   if ($choice==1) {
   print(&lt;&lt;END);
-1) Machine Name: $perlvar{'lonHostID'}
+2) Domain Name: $perlvar{'lonDefDomain'}
 ENTER NEW VALUE:
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
-    $perlvar{'lonHostID'}=$choice2;
+    $perlvar{'lonDefDomain'}=$choice2;
   }
   elsif ($choice==2) {
   print(&lt;&lt;END);
-2) Domain Name: $perlvar{'lonDefDomain'}
+1) Machine Name: $perlvar{'lonHostID'}
 ENTER NEW VALUE:
 END
     my $choice2=&lt;&gt;;
     chomp($choice2);
-    $perlvar{'lonDefDomain'}=$choice2;
+    $perlvar{'lonHostID'}=$choice2;
   }
   elsif ($choice==3) {
   print(&lt;&lt;END);
@@ -411,7 +414,7 @@
       die("Cannot output to $confdir$filename\n");
     foreach my $key (keys %perlvar) {
       my $value=$perlvar{$key};
-      print(OUT &lt;&lt;END) unless $perlvarstat{$key};
+      print(OUT &lt;&lt;END) unless $perlvarstatic{$key};
 PerlSetVar     $key      $value
 END
     }