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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 20 Apr 2007 19:32:59 -0000


albertel		Fri Apr 20 15:32:59 2007 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  - check all files including the dns ones for library servers and the domain description
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.54 doc/loncapafiles/updatequery.piml:1.55
--- doc/loncapafiles/updatequery.piml:1.54	Fri Apr 20 14:14:26 2007
+++ doc/loncapafiles/updatequery.piml	Fri Apr 20 15:32:59 2007
@@ -1,6 +1,6 @@
 <!-- updatequery.piml -->
 
-<!-- $Id: updatequery.piml,v 1.54 2007/04/20 18:14:26 albertel Exp $ -->
+<!-- $Id: updatequery.piml,v 1.55 2007/04/20 19:32:59 albertel Exp $ -->
 
 <!--
 
@@ -421,7 +421,7 @@
 while (!$flag) {
   print(&lt;&lt;END);
 
-**** Server Administrator's E-mail ****
+**** Server Administrators E-mail ****
 E-mail address of the person who will manage this machine
 [should be in the form somebody\@somewhere]
 ENTER ADMIN E-MAIL ADDRESS:
@@ -606,79 +606,59 @@
 	}
 	close(CONFIG);
     }
-    if (!$domainDescription && $lonCluster ne 'existing') {
-       open(IN,'&lt;../'.$lonCluster.'_domain.tab');
-       while(&lt;IN&gt;) {
-          if (/^$perlvar{'lonDefDomain'}\:/) {
-	     (undef,$domainDescription,$domainTabExtras)=split(/:/,$_,3);
-	     chomp($domainDescription);
-	     chomp($domainTabExtras);
-	     # the remianing field (primary lib server) is handled later
-	     $domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0..5]);
-             last;
-          }
-       }
-       close(IN);
-    }
+
+    my (@hosts_files, @domain_files);
+    if ( $lonCluster ne 'existing') {
+	push(@domain_files,'../'.$lonCluster.'_domain.tab',
+	     '../'.$lonCluster.'_dns_domain.tab');
+	push(@hosts_files,'../'.$lonCluster.'_hosts.tab',
+	     '../'.$lonCluster.'_dns_hosts.tab');
+    }
+    push(@domain_files,'/home/httpd/lonTabs/domain.tab',
+         '/home/httpd/lonTabs/dns_domain.tab');
+    push(@hosts_files,'/home/httpd/lonTabs/hosts.tab',
+         '/home/httpd/lonTabs/dns_hosts.tab');
+
     if (!$domainDescription) {
-       open(IN,'&lt;/home/httpd/lonTabs/domain.tab');
-       while(&lt;IN&gt;) {
-          if (/^$perlvar{'lonDefDomain'}\:/) {
-	     (undef,$domainDescription,$domainTabExtras)=split(/:/,$_,3);
-	     chomp($domainDescription);
-	     chomp($domainTabExtras);
-	     # the remianing field (primary lib server) is handled later
-	     $domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0..5]);
-             last;
-          }
-       }
-       close(IN);
+	foreach my $file (@domain_files) {
+	    open(IN,'&lt;'.$file);
+	    while(my $line = &lt;IN&gt;) {
+		if ($line =~ /^\Q$perlvar{'lonDefDomain'}\E\:/) {
+		    (undef,$domainDescription,$domainTabExtras)=split(/:/,$line,3);
+		    chomp($domainDescription);
+		    chomp($domainTabExtras);
+		    # the remianing field (primary lib server) is handled later
+		    $domainTabExtras = join(':',(split(/:/,$domainTabExtras))[0..5]);
+		    last;
+		}
+	    }
+	    close(IN);
+	    last if ($domainDescription);
+	}
     }
-    if (!$primaryLibServer and $lonCluster ne 'existing') {
-        open(IN,'&lt;../'.$lonCluster.'_domain.tab');
-        while(&lt;IN&gt;) {
-            if (/^$perlvar{'lonDefDomain'}\:/) {
-                (undef,undef,undef,undef,undef,undef,undef,undef,
-                                              $primaryLibServer)=split(/:/,$_);
+
+    while(!$primaryLibServ && (@hosts_file || @domain_files)) {
+	my $file = shift(@domain_files);
+        open(IN,'&lt;'.$file);
+        while(my $line = &lt;IN&gt;) {
+            if ($line =~ /^\Q$perlvar{'lonDefDomain'}\E\:/) {
+		$primaryLibServer=(split(/:/,$line))[8];
                 chomp($primaryLibServer);
             }
         }
         close(IN);
-        if (!$primaryLibServer) {
-            open(IN,'&lt;../'.$lonCluster.'_hosts.tab');
-            while(&lt;IN&gt;) {
-                if (/^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) {
-                    push(@libservers,$1);
-                }
-            }
-            close(IN);
-            if (@libservers == 1) {
-                $primaryLibServer = $libservers[0];
-            }
-        }
-    }
-    if (!$primaryLibServer) {
-        open(IN,'&lt;/home/httpd/lonTabs/domain.tab');
-        while(&lt;IN&gt;) {
-            if (/^$perlvar{'lonDefDomain'}\:/) {
-                (undef,undef,undef,undef,undef,undef,undef,undef,
-                                              $primaryLibServer)=split(/:/,$_);
-                chomp($primaryLibServer);
-            }
-            close(IN);
-        }
-        if (!$primaryLibServer) {
-            open(IN,'&lt;/home/httpd/lonTabs/hosts.tab');
-            while(&lt;IN&gt;) {
-                if (/^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) {
-                    push(@libservers,$1);
-                }
-            }
-            close(IN);
-            if (@libservers == 1) {
-                $primaryLibServer = $libservers[0];
-            }
-        }
+	last if ($primaryLibServer);
+	$file = shift(@hosts_files);
+	open(IN,'&lt;'.$file);
+	while(my $line = &lt;IN&gt;) {
+	    if ($line =~ /^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) {
+		push(@libservers,$1);
+	    }
+	}
+	close(IN);
+	if (@libservers == 1) {
+	    $primaryLibServer = $libservers[0];
+	}
     }
    
 # implement editing logic below, interactively