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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 09 Dec 2002 21:10:44 -0000


albertel		Mon Dec  9 16:10:44 2002 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  - doing BUG#1034
  - reversed order, now asks about cluster before asking about values
  - grabs domain info from to be installed hosts.tab if it exists
  - FIXME doesn't handle standalone properly yet
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.21 doc/loncapafiles/updatequery.piml:1.22
--- doc/loncapafiles/updatequery.piml:1.21	Mon Dec  9 13:54:40 2002
+++ doc/loncapafiles/updatequery.piml	Mon Dec  9 16:10:44 2002
@@ -1,7 +1,7 @@
 <!-- updatequery.piml -->
 <!-- Scott Harrison -->
 
-<!-- $Id: updatequery.piml,v 1.21 2002/12/09 18:54:40 albertel Exp $ -->
+<!-- $Id: updatequery.piml,v 1.22 2002/12/09 21:10:44 albertel Exp $ -->
 
 <!--
 
@@ -52,6 +52,70 @@
 </perlscript>
 </file>
 <file>
+<target dist='default'>loncom/hosts.tab</target>
+<perlscript mode='fg'>
+unless (-l "<TARGET />") {
+  print(&lt;&lt;END);
+
+===============================================================================
+What hosts.tab would you like to have installed?
+(hosts.tab is a listing of all other internet machines
+that a server system considers to be valid server systems
+on the LON-CAPA network)
+
+1) PRODUCTION - you want to deliver courses today or sometime very soon
+                on this machine
+2) STAND-ALONE - you want this machine to run in 'stand-alone' mode and
+                 not be connected to other LON-CAPA machines for now
+3) DEVELOPMENT - you want to play with or explore LON-CAPA
+4) PRESERVE the existing hosts.tab (/home/httpd/lonTabs/hosts.tab)
+
+END
+# Option number 26 will install rawhide_hosts.tab, but
+# the typical user does not want to be part of an intensive
+# machine test cluster.
+
+# get input
+# if valid then process, otherwise loop
+$flag=0;
+while (!$flag) {
+  print "ENTER 1, 2, 3, or 4:\n";
+  my $choice=&lt;&gt;;
+  chomp($choice);
+  if ($choice==1) {
+    $lonCluster='production'; $flag=1;
+  }
+  elsif ($choice==2) {
+	die("FIXME Broken!!!");
+    $lonCluster='standalone'; $flag=1;
+    open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or
+      die('file generation error');
+      print(OUT $line2insert);
+    close(OUT);
+  }
+  elsif ($choice==3) {
+    $lonCluster='development'; $flag=1;
+  }
+  elsif ($choice==4) {
+    $lonCluster='existing'; $flag=1;
+    if (-e '/home/httpd/lonTabs/hosts.tab') {
+      `cp /home/httpd/lonTabs/hosts.tab ../existing_hosts.tab`;
+    }
+    else {
+      print &lt;&lt;END;
+There is no existing /home/httpd/lonTabs/hosts.tab
+END
+      die('');
+    }
+  }
+  elsif ($choice==26) {
+    $lonCluster='rawhide'; $flag=1;
+  }
+}
+}
+</perlscript>
+</file>
+<file>
 <target dist='default'>/home/httpd/lonTabs/hosts.tab</target>
 <perlscript mode='fg'>
 $|=1;
@@ -376,8 +440,19 @@
 	}
 	close(CONFIG);
     }
+    unless ($domainDescription) {
+       open(IN,'&lt;../'.$lonCluster.'_hosts.tab');
+       while(&lt;IN&gt;) {
+          if (/^$perlvar{'lonHostID'}\:/) {
+	     (undef,undef,undef,undef,undef,$domainDescription)=split(/:/,$_);
+	     chomp($domainDescription);
+             last;
+          }
+       }
+       close(IN);	
+    }
 # implement editing logic below, interactively
-# update loncapa.conf until 7 is entered
+# update loncapa.conf until 8 is entered
 
 $flag=0;
 
@@ -517,72 +592,17 @@
 <target dist='default'>loncom/hosts.tab</target>
 <perlscript mode='fg'>
 unless (-l "<TARGET />") {
-  print(&lt;&lt;END);
-
-===============================================================================
-What hosts.tab would you like to have installed?
-(hosts.tab is a listing of all other internet machines
-that a server system considers to be valid server systems
-on the LON-CAPA network)
-
-1) PRODUCTION - you want to deliver courses today or sometime very soon
-                on this machine
-2) STAND-ALONE - you want this machine to run in 'stand-alone' mode and
-                 not be connected to other LON-CAPA machines for now
-3) DEVELOPMENT - you want to play with or explore LON-CAPA
-4) PRESERVE the existing hosts.tab (/home/httpd/lonTabs/hosts.tab)
-
-END
-# Option number 26 will install rawhide_hosts.tab, but
-# the typical user does not want to be part of an intensive
-# machine test cluster.
-
-# get input
-# if valid then process, otherwise loop
-my $hostname=`hostname`;chomp($hostname);
-my $hostaddress=`hostname -i $hostname`;chomp($hostaddress);
-$hostaddress=~s/\s//;
-$flag=0;
-while (!$flag) {
-  print "ENTER 1, 2, 3, or 4:\n";
-  my $choice=&lt;&gt;;
-  chomp($choice);
-  $line2insert=&lt;&lt;END;
-$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress:$domainDescription
-END
+  my $hostname=`hostname`;chomp($hostname);
+  my $hostaddress=`hostname -i $hostname`;chomp($hostaddress);
+  $hostaddress=~s/\s//;
   $date=`date -I`; chomp($date);
   $lonHostID=$perlvar{'lonHostID'};
   $lonHostID=~s/\W//g;
   $lineexistflag=0;
   $hostidexistflag=0;
-  if ($choice==1) {
-    $lonCluster='production'; $flag=1;
-  }
-  elsif ($choice==2) {
-    $lonCluster='standalone'; $flag=1;
-    open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or
-      die('file generation error');
-      print(OUT $line2insert);
-    close(OUT);
-  }
-  elsif ($choice==3) {
-    $lonCluster='development'; $flag=1;
-  }
-  elsif ($choice==4) {
-    $lonCluster='existing'; $flag=1;
-    if (-e '/home/httpd/lonTabs/hosts.tab') {
-      `cp /home/httpd/lonTabs/hosts.tab ../existing_hosts.tab`;
-    }
-    else {
-      print &lt;&lt;END;
-There is no existing /home/httpd/lonTabs/hosts.tab
+  $line2insert=&lt;&lt;END;
+$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress:$domainDescription
 END
-      die('');
-    }
-  }
-  elsif ($choice==26) {
-    $lonCluster='rawhide'; $flag=1;
-  }
   if ($flag==1) {
     `rm -f ../hosts.tab`;
     open(IN,'&lt;../'.$lonCluster.'_hosts.tab');
@@ -635,8 +655,6 @@
       `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
     }
   }
-}
-
 }
 </perlscript>
 </file>