Diff for /doc/loncapafiles/updatequery.piml between versions 1.38 and 1.45

version 1.38, 2005/05/21 15:35:07 version 1.45, 2006/01/07 14:29:16
Line 70  you must contact lon-capa\@lon-capa.org. Line 70  you must contact lon-capa\@lon-capa.org.
 3) DEVELOPMENT - you want to do software (not content!) development with  3) DEVELOPMENT - you want to do software (not content!) development with
                  this workstation and eventually link it with the                   this workstation and eventually link it with the
                  workstations of other LON-CAPA software developers.                   workstations of other LON-CAPA software developers.
 4) PRESERVE the existing hosts.tab and domain.tab  4) RUNNING YOUR OWN CLUSTER - this machine is not in the standard LON-CAPA
                 (/home/httpd/lonTabs/hosts.tab and                   clusters and won't be in the future and you want the existing
                  /home/httpd/lonTabs/domain.tab)                   hosts.tab and domain.tab files to be left alone.
                    (This choice is unlikely what you want to select.)
 END  END
 # Option number 26 will install rawhide_hosts.tab, but  # Option number 26 will install rawhide_hosts.tab, but
 # the typical user does not want to be part of an intensive  # the typical user does not want to be part of an intensive
Line 129  END Line 129  END
 $|=1;  $|=1;
 my $domainDescription;  my $domainDescription;
 my $domainTabExtras;  my $domainTabExtras;
   my $primaryLibServer;
   my @libservers = ();
 unless (-e "<TARGET />") {  unless (-e "<TARGET />") {
   print(&lt;&lt;END);    print(&lt;&lt;END);
            WELCOME TO LON-CAPA!             WELCOME TO LON-CAPA!
Line 205  if ($hostname=~/([^\.]*)\.([^\.]*)$/) { Line 207  if ($hostname=~/([^\.]*)\.([^\.]*)$/) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
   
 **** Domain ****  **** Domain ****
 [this does NOT need to correspond to internet address domains,  [This does NOT need to correspond to internet address domains.
  good examples might be "msu" or "bionet" or "vermontcc",   Please make this name short AND descriptive of your organization.
  bad examples are "physics" (too general)   Domain names are close to impossible to change later!!!
    Good examples might be "msu" or "bionet" or "vermontcc".
    Bad examples are "physics" (too general)
    or "michiganstateuniversity" (too long)     or "michiganstateuniversity" (too long)
    or "msuedu" (internet domain, just make it "msu")     or "msuedu" (internet domain, just make it "msu")
    or "msuphysics" (only if there is a good reason to limit)     or "msuphysics" (only if there is a good reason to limit to department
                       - we don't know of one)
    or "mydomain" (what is that?)     or "mydomain" (what is that?)
  Please make this name short AND descriptive of your organization.   Avoid multiple domains at the same institution, even if it means that you 
  Note that the domain is very hard to change later.   have to actually work together with your colleagues. You can still run
  Double-check with the LON-CAPA group at MSU if this domain is    multiple library servers within the same domain.
  going to be part of the main production cluster, since it needs   If this domain is eventually going to be part of the main production
  to be unique.]   cluster, you MUST contact the LON-CAPA group at MSU (loncapa@loncapa.org)
    to have a domain name assigned, and then use it exactly as given. This is
    also true for test installs that might eventually turn into production setups.
    Stop now if you didn't do so.]
 END  END
   
 # get domain name  # get domain name
Line 237  END Line 245  END
   my $choice=&lt;&gt;;    my $choice=&lt;&gt;;
   chomp($choice);    chomp($choice);
   my $bad_domain_flag=0;    my $bad_domain_flag=0;
   my @bad_domain_names=('res','raw','userfiles','priv','adm','uploaded');    my @bad_domain_names=('res','raw','userfiles','priv','adm','uploaded',
    'editupload');
   foreach my $bad (@bad_domain_names) {    foreach my $bad (@bad_domain_names) {
     $bad_domain_flag=1 if $choice eq $bad;      $bad_domain_flag=1 if $choice eq $bad;
   }    }
Line 307  if ($lonDefDomain) { Line 316  if ($lonDefDomain) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
   
 **** Machine ID Name ****  **** Machine ID Name ****
 [this does NOT need to correspond to internet address names;  [This does NOT need to correspond to internet address names;
  this name MUST be unique to the whole LON-CAPA network;   this name MUST be unique to the whole LON-CAPA network;
  we recommend that you use a name based off of your institution;   we recommend that you use a name based off of your institution.
  good examples: "msul1" or "bioneta2";   Good examples: "msul1" or "bioneta2".
  bad examples: "loncapabox" or "studentsinside".   Bad examples: "loncapabox" or "studentsinside".
  Note that machine names are very hard to change later.]   Note that machine names are very hard to change later.]
 END  END
 # get machine name  # get machine name
Line 354  END Line 363  END
   }    }
 }  }
   
   # get primary library server in domain
   if ($lonRole eq 'library') {
       if (!grep/^\Q$lonHostID\E$/,@libservers) {
           push(@libservers,$lonHostID);
       } 
       if (@libservers == 1) {
           $primaryLibServer = $libservers[0];
       }
   }
   while (!$flag) {
     print(&lt;&lt;END);
   **** Domain's Primary Library Server ID ****
   This should be the LON-CAPA machine ID of a library server in your 
   domain.  If you only have a single library server in your domain, then
   the Primary Library server ID will be the machine ID of that server. 
   This server will be where domain data which are not associated with any
   specific home library server will be stored (e.g., e-mail broadcast by
   administrators to users in the domain).
   END
       if (defined($primaryLibServer)) {
           print(&lt;&lt;END);
   ENTER DOMAIN'S PRIMARY LIBRARY SERVER ID [$primaryLibServer]:
   END
       } elsif (@libservers > 0) {
           print(&lt;&lt;END);
   ENTER DOMAIN'S PRIMARY LIBRARY SERVER ID [$libservers[0]]
   END
       } else {
           print (&lt;&lt;END);
   No library servers could be identified for this domain.  If you have already installed LON-CAPA on a different server (designated as a library server) in this domain, please enter the LONCAPA MACHINE ID of that server.  If not, you will need to install a LON-CAPA library server.  Enter the MACHINE ID of the server you plan to designate as a library server.
   END
       }
   
       my $choice=&lt;&gt;;
       chomp($choice);
       if ($primaryLibServer and $choice=~/^\s*$/) {
           $choice=$primaryLibServer;
           open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
           print(OUT 'primaryLibServer'."\t".$choice."\n");
           close(OUT);
           $flag=1;
       } elsif (length($choice)>15) {
           print "Name too long\n";
       } elsif (length($choice)<4) {
           print "Name too short\n";
       } elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
           open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
           print(OUT 'primaryLibServer'."\t".$choice."\n");
           close(OUT);
           $primaryLibServer=$choice;
           $flag=1;
       } else {
           print "Invalid input (only alphanumeric characters supported).\n";
       }
   }
   
   
 # get admin e-mail address  # get admin e-mail address
 # accept if valid, if not valid, tell user and repeat  # accept if valid, if not valid, tell user and repeat
 $flag=0;  $flag=0;
Line 563  my %perlvarstatic; Line 629  my %perlvarstatic;
        }         }
        close(IN);         close(IN);
     }      }
       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(/:/,$_);
                   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];
               }
           }
       }
         
 # implement editing logic below, interactively  # implement editing logic below, interactively
 # update loncapa.conf until 8 is entered  # update loncapa.conf until 8 is entered
Line 577  This is now the current configuration of Line 689  This is now the current configuration of
  1) Domain Name: $perlvar{'lonDefDomain'}   1) Domain Name: $perlvar{'lonDefDomain'}
  2) Domain Description: $domainDescription   2) Domain Description: $domainDescription
  3) Machine Name: $perlvar{'lonHostID'}   3) Machine Name: $perlvar{'lonHostID'}
  4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}   4) ID of primary library server for domain: $primaryLibServer
  5) Support E-mail Address: $perlvar{'lonSupportEMail'}   5) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
  6) Role: $perlvar{'lonRole'}   6) Support E-mail Address: $perlvar{'lonSupportEMail'}
  7) Cache Expiration Time: $perlvar{'lonExpire'}   7) Role: $perlvar{'lonRole'}
  8) Server Load: $perlvar{'lonLoadLim'}   8) Cache Expiration Time: $perlvar{'lonExpire'}
  9) User Load: $perlvar{'lonUserLoadLim'}   9) Server Load: $perlvar{'lonLoadLim'}
 10) Allow only secure connections: $securestatus   10) User Load: $perlvar{'lonUserLoadLim'}
 11) Everything is correct up above  11) Allow only secure connections: $securestatus 
   12) Everything is correct up above
 END  END
   
 my $error='';  my $error='';
 foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) {  foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) {
    if (length($v)>16) { $error.="\nName $v too long"; }     if (length($v)>16) { $error.="\nName $v too long"; }
    if (length($v)<2) { $error.="\nName $v too short"; }     if (length($v)<2) { $error.="\nName $v too short"; }
    if ($v=~/capa/i) { $error.="\nName $v contains 'capa'"; }     if ($v=~/capa/i) {
    foreach my $bad ('res','raw','userfiles','priv','adm','uploaded') {   if ($v!~/^oucapa\d+$/ && 
       ($v!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) {
    $error.="\nName $v contains 'capa'"; 
    }
      }
      foreach my $bad ('res','raw','userfiles','priv','adm','uploaded',
    'editupload') {
       $error.="\nName $v reserved." if $v eq $bad;        $error.="\nName $v reserved." if $v eq $bad;
    }     }
    if ($v=~/\W/) { $error.="\nName $v contains special characters"; }     if ($v=~/\W/) { $error.="\nName $v contains special characters"; }
 }  }
 if ($domainDescription!~/^[\w\s]+$/) {  if ($domainDescription!~/^[\(\)\-\w\s,]+$/) {
    $error.="\nDomain Description contains special characters";     $error.="\nDomain Description contains special characters";
 }   } 
 foreach my $v ($perlvar{'lonExpire'},$perlvar{'lonLoadLim'}) {  foreach my $v ($perlvar{'lonExpire'},$perlvar{'lonLoadLim'}) {
Line 606  foreach my $v ($perlvar{'lonExpire'},$pe Line 725  foreach my $v ($perlvar{'lonExpire'},$pe
 unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) {  unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) {
    $error.="\nInvalid Role";     $error.="\nInvalid Role";
 }  }
   
   if (!defined($primaryLibServer)) {
      if (@libservers > 0) {
          $error .= "No primary library server ID designated. Choose from: ".join(',',sort(@libservers));
      } else {
          $error .= "No library servers in this domain (including current server)";
      }
   } else {
      if (length($primaryLibServer)>16) { $error.="\nPrimary Library Server ID:  $primaryLibServer too long"; }
      if (length($primaryLibServer)<2) { $error.="\nPrimary Library Server ID:  $primaryLibServer too short"; }
      if ($primaryLibServer =~/capa/i) {
           if ($primaryLibServer!~/^oucapa\d+$/ &&
               ($primaryLibServer!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) {
                    $error.="\nPrimary library server ID $primaryLibServer contains 'capa'";
           }
      }
      foreach my $bad ('res','raw','userfiles','priv','adm','uploaded',
           'editupload') {
         $error.="\nPrimary library server ID $primaryLibServer reserved." if $primaryLibServer eq $bad;
      }
      if ($primaryLibServer=~/\W/) { $error.="\nPrimary library server ID $primaryLibServer contains special characters"; }
   }
   
   
 if ($error) { print "\n*** ERRORS: $error\n"; }  if ($error) { print "\n*** ERRORS: $error\n"; }
   print(&lt;&lt;END);    print(&lt;&lt;END);
 ENTER A CHOICE OF 1-10 TO CHANGE, otherwise ENTER 11:  ENTER A CHOICE OF 1-11 TO CHANGE, otherwise ENTER 12:
 END  END
 my $choice=&lt;&gt;;  my $choice=&lt;&gt;;
 chomp($choice);  chomp($choice);
Line 648  END Line 791  END
   }    }
   elsif ($choice==4) {    elsif ($choice==4) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}  4) ID of primary library server for domain: $primaryLibServer
   ENTER NEW VALUE (this will be the LON-CAPA Machine ID of a library server in
                    your domain; it cannot contain any of '_' '-' '.' or ':'. 
                    This server will be where domain data which are not 
                    associated with any specific home library server
                    will be stored (e.g., e-mail broadcast by Domain Coordinators
                    to users in the domain).
   END
       my $choice2=&lt;&gt;;
       chomp($choice2);
       $primaryLibServer=$choice2;
     }
     elsif ($choice==5) {
     print(&lt;&lt;END);
   5) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
 ENTER NEW VALUE:  ENTER NEW VALUE:
 END  END
     my $choice2=&lt;&gt;;      my $choice2=&lt;&gt;;
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonAdmEMail'}=$choice2;      $perlvar{'lonAdmEMail'}=$choice2;
   }    }
   elsif ($choice==5) {    elsif ($choice==6) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 5) Support E-mail Address: $perlvar{'lonSupportEMail'}  6) Support E-mail Address: $perlvar{'lonSupportEMail'}
 ENTER NEW VALUE:  ENTER NEW VALUE:
 END  END
     my $choice2=&lt;&gt;;      my $choice2=&lt;&gt;;
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonSupportEMail'}=$choice2;      $perlvar{'lonSupportEMail'}=$choice2;
   }    }
   elsif ($choice==6) {    elsif ($choice==7) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 6) Role: $perlvar{'lonRole'}  7) Role: $perlvar{'lonRole'}
 ENTER NEW VALUE (this should be either 'access' or 'library'   ENTER NEW VALUE (this should be either 'access' or 'library' 
                  if in doubt select 'library'):                   if in doubt select 'library'):
 END  END
Line 674  END Line 831  END
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonRole'}=$choice2;      $perlvar{'lonRole'}=$choice2;
   }    }
   elsif ($choice==7) {    elsif ($choice==8) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 7) Cache Expiration Time: $perlvar{'lonExpire'}  8) Cache Expiration Time: $perlvar{'lonExpire'}
 ENTER NEW VALUE (in seconds, 86400 is a reasonable value):  ENTER NEW VALUE (in seconds, 86400 is a reasonable value):
 END  END
     my $choice2=&lt;&gt;;      my $choice2=&lt;&gt;;
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonExpire'}=$choice2;      $perlvar{'lonExpire'}=$choice2;
   }    }
   elsif ($choice==8) {    elsif ($choice==9) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 8) Server Load: $perlvar{'lonLoadLim'}  9) Server Load: $perlvar{'lonLoadLim'}
 ENTER NEW VALUE:  ENTER NEW VALUE:
 END  END
     my $choice2=&lt;&gt;;      my $choice2=&lt;&gt;;
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonLoadLim'}=$choice2;      $perlvar{'lonLoadLim'}=$choice2;
   }    }
   elsif ($choice==9) {    elsif ($choice==10) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 9) User Load: $perlvar{'lonUserLoadLim'}  10) User Load: $perlvar{'lonUserLoadLim'}
 Numer of users that can login before machine is 'overloaded'  Numer of users that can login before machine is 'overloaded'
 ENTER NEW VALUE (integer value, 0 means there is no limit):  ENTER NEW VALUE (integer value, 0 means there is no limit):
 END  END
Line 702  END Line 859  END
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonUserLoadLim'}=$choice2;      $perlvar{'lonUserLoadLim'}=$choice2;
   }    }
   elsif ($choice==10) {    elsif ($choice==11) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 10) Allow only secure connections: $securestatus   11) Allow only secure connections: $securestatus 
 The Lon-CAPA communication daemons lonc and lond can be configured to  The Lon-CAPA communication daemons lonc and lond can be configured to
 allow only secure connections by default.  allow only secure connections by default.
   
Line 731  END Line 888  END
     }      }
     ($securestatus,$securenum)=&securesetting(%perlvar);      ($securestatus,$securenum)=&securesetting(%perlvar);
   }    }
   elsif (($choice==11) && (!$error)) {    elsif (($choice==12) && (!$error)) {
     $flag=1;      $flag=1;
   }    }
   else {    else {
Line 762  unless (-l "<TARGET />") { Line 919  unless (-l "<TARGET />") {
   $line2insert=&lt;&lt;END;    $line2insert=&lt;&lt;END;
 $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname  $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname
 END  END
   $domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras\n";    $domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras:$primaryLibServer\n";
   if ($lonCluster eq 'standalone') {    if ($lonCluster eq 'standalone') {
     open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or      open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or
       die('file generation error');        die('file generation error');

Removed from v.1.38  
changed lines
  Added in v.1.45


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>