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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 19 May 2003 18:35:50 -0000


albertel		Mon May 19 14:35:50 2003 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml valid_hosts.xfml 
  Log:
  - should now properly configure hosts.tab and domain.tab
   (doesn't support configuring lucas's extensions though)
  - shoul properl install them during the make hosts_tab step
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.26 doc/loncapafiles/updatequery.piml:1.27
--- doc/loncapafiles/updatequery.piml:1.26	Thu May  8 18:17:33 2003
+++ doc/loncapafiles/updatequery.piml	Mon May 19 14:35:50 2003
@@ -1,6 +1,6 @@
 <!-- updatequery.piml -->
 
-<!-- $Id: updatequery.piml,v 1.26 2003/05/08 22:17:33 albertel Exp $ -->
+<!-- $Id: updatequery.piml,v 1.27 2003/05/19 18:35:50 albertel Exp $ -->
 
 <!--
 
@@ -57,17 +57,20 @@
   print(&lt;&lt;END);
 
 ===============================================================================
-What hosts.tab would you like to have installed?
+What hosts.tab and domain.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)
+on the LON-CAPA network
+domain.tab is a description of the internal LON-CAPA domains)
 
 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)
+4) PRESERVE the existing hosts.tab and domain.tab
+                (/home/httpd/lonTabs/hosts.tab and
+                 /home/httpd/lonTabs/domain.tab)
 
 END
 # Option number 26 will install rawhide_hosts.tab, but
@@ -101,6 +104,15 @@
 END
       die('');
     }
+    if (-e '/home/httpd/lonTabs/domain.tab') {
+      `cp /home/httpd/lonTabs/domain.tab ../existing_domain.tab`;
+    }
+    else {
+      print &lt;&lt;END;
+There is no existing /home/httpd/lonTabs/domain.tab
+END
+      die('');
+    }
   }
   elsif ($choice==26) {
     $lonCluster='rawhide'; $flag=1;
@@ -441,10 +453,10 @@
 	close(CONFIG);
     }
     if (!$domainDescription && $lonCluster ne 'existing') {
-       open(IN,'&lt;../'.$lonCluster.'_hosts.tab');
+       open(IN,'&lt;../'.$lonCluster.'_domain.tab');
        while(&lt;IN&gt;) {
-          if (/^$perlvar{'lonHostID'}\:/) {
-	     (undef,undef,undef,undef,undef,$domainDescription)=split(/:/,$_);
+          if (/^$perlvar{'lonDefDomain'}\:/) {
+	     (undef,$domainDescription)=split(/:/,$_);
 	     chomp($domainDescription);
              last;
           }
@@ -452,10 +464,10 @@
        close(IN);
     }
     if (!$domainDescription) {
-       open(IN,'&lt;/home/httpd/lonTabs/hosts.tab');
+       open(IN,'&lt;/home/httpd/lonTabs/domain.tab');
        while(&lt;IN&gt;) {
-          if (/^$perlvar{'lonHostID'}\:/) {
-	     (undef,undef,undef,undef,undef,$domainDescription)=split(/:/,$_);
+          if (/^$perlvar{'lonDefDomain'}\:/) {
+	     (undef,$domainDescription)=split(/:/,$_);
 	     chomp($domainDescription);
              last;
           }
@@ -624,13 +636,18 @@
   $lineexistflag=0;
   $hostidexistflag=0;
   $line2insert=&lt;&lt;END;
-$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress:$domainDescription
+$perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$hostaddress
 END
+  $domaininsert="$perlvar{'lonDefDomain'}:$domainDescription\n";
   if ($lonCluster eq 'standalone') {
     open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or
       die('file generation error');
       print(OUT $line2insert);
     close(OUT);
+    open(OUT,'&gt;../'.$lonCluster.'_domain.tab') or
+      die('file generation error');
+      print(OUT $domaininsert);
+    close(OUT);
   }
   if ($flag==1) {
     `rm -f ../hosts.tab`;
@@ -682,6 +699,59 @@
       `ln -s new_${lonCluster}_hosts.tab ../hosts.tab`;
       # email appropriate message
       `echo "INSERT:$lonCluster:$lonHostID:$date:$line2insert" | mail -s "INSERT:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
+    }
+  }
+  $lineexistflag=0;
+  if ($flag==1) {
+    `rm -f ../domain.tab`;
+    open(IN,'&lt;../'.$lonCluster.'_domain.tab');
+    while(&lt;IN&gt;) {
+      if (/^$domaininsert$/) {
+        $lineexistflag=1;
+      }
+      if (/^$perlvar{'lonDefDomain'}\:/) {
+        $domainexistflag=1;
+      }
+    }
+    close(IN);
+    if ($domainexistflag and !$lineexistflag) {
+      print &lt;&lt;END;
+WARNING: $perlvar{'lonDefDomain'} already exists inside
+loncapa/loncom/${lonCluster}_domain.tab.  The entry inside
+${lonCluster}_domain.tab does not match your settings.
+The entry inside ${lonCluster}_domain.tab is being replaced
+with your new values.
+END
+      `grep -v "$perlvar{'lonDefDomain'}:" ../${lonCluster}_domain.tab &gt; ../new_${lonCluster}_domain.tab`;
+       open(OUT,'&gt;&gt;../new_'.$lonCluster.'_domain.tab') or
+         die("cannot open loncom/${lonCluster}_domain.tab for output\n");
+         print(OUT $domaininsert);
+       close(OUT);
+      `ln -s new_${lonCluster}_domain.tab ../domain.tab`;
+      # email appropriate message
+      system('ping -c 1 www.lon-capa.org > /dev/null || ping -c 1 www.msu.edu > /dev/null || ping -c 1 www.mit.edu > /dev/null');
+      `echo "REPLACEdom:$lonCluster:$lonHostID:$date:$domaninsert" | mail -s "REPLACEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org` unless $?;
+    }
+    elsif ($domainexistflag and $lineexistflag) {
+      print &lt;&lt;END;
+Entry exists in ${lonCluster}_domain.tab.
+END
+      `ln -s ${lonCluster}_domain.tab ../domain.tab`;
+      # email appropriate message
+      `echo "STABLEUPDATEdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "STABLEUPDATEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
+    }
+    elsif (!$domainexistflag and !$lineexistflag) {
+      print &lt;&lt;END;
+New entry for $lonCluster.
+END
+      `cat ../${lonCluster}_domain.tab &gt; ../new_${lonCluster}_domain.tab`;
+       open(OUT,'&gt;&gt;../new_'.$lonCluster.'_domain.tab') or
+         die("cannot open loncom/new_${lonCluster}_domain.tab for output\n");
+         print(OUT $domaininsert);
+       close(OUT);
+      `ln -s new_${lonCluster}_domain.tab ../domain.tab`;
+      # email appropriate message
+      `echo "INSERTdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "INSERTdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
     }
   }
 }
Index: doc/loncapafiles/valid_hosts.xfml
diff -u doc/loncapafiles/valid_hosts.xfml:1.5 doc/loncapafiles/valid_hosts.xfml:1.6
--- doc/loncapafiles/valid_hosts.xfml:1.5	Mon Feb  3 13:03:51 2003
+++ doc/loncapafiles/valid_hosts.xfml	Mon May 19 14:35:50 2003
@@ -2,7 +2,7 @@
  "/home/harris41/loncapa/loncom/build/xfml.dtd">
 <!-- valid_hosts.xfml -->
 
-<!-- $Id: valid_hosts.xfml,v 1.5 2003/02/03 18:03:51 harris41 Exp $ -->
+<!-- $Id: valid_hosts.xfml,v 1.6 2003/05/19 18:35:50 albertel Exp $ -->
 
 <!--
 
@@ -37,7 +37,7 @@
 <xfml>
 <clause>
 <when:name match='/^source$/'>
-<when:cdata match='!/^loncom\/hosts\.tab$/'>
+<when:cdata match='!/^loncom\/(hosts|domain)\.tab$/'>
 <choice:exclude nodename='file' />
 </when:cdata>
 </when:name>