Diff for /doc/loncapafiles/updatequery.piml between versions 1.83 and 1.84

version 1.83, 2016/07/29 17:26:44 version 1.84, 2016/07/30 00:38:14
Line 33  http://www.lon-capa.org/ Line 33  http://www.lon-capa.org/
 <target dist='default'>/</target>  <target dist='default'>/</target>
 <perlscript mode='fg'>  <perlscript mode='fg'>
 $|=1;  $|=1;
   use strict;  use strict;
   
   print(&lt;&lt;END);    print(&lt;&lt;END);
   
   
Line 128  my $domainTabExtras; Line 129  my $domainTabExtras;
 my $primaryLibServer;  my $primaryLibServer;
 my $protocol;  my $protocol;
 my $intdom;  my $intdom;
   my $desiredhostname;
 my @libservers = ();  my @libservers = ();
 unless (-e "<TARGET />") {  unless (-e "<TARGET />") {
   print(&lt;&lt;END);    print(&lt;&lt;END);
Line 137  If you have questions, please visit http Line 139  If you have questions, please visit http
 or contact helpdesk\@loncapa.org.  or contact helpdesk\@loncapa.org.
   
 ===============================================================================  ===============================================================================
 The following 7 values are needed to configure LON-CAPA:  The following 8 values are needed to configure LON-CAPA:
 * Machine Role  * Machine Role
 * LON-CAPA Domain Name  * LON-CAPA Domain Name
 * LON-CAPA Machine ID Name  * LON-CAPA Machine ID Name
Line 145  The following 7 values are needed to con Line 147  The following 7 values are needed to con
 * LON-CAPA Domain's Primary Library Server Machine ID  * LON-CAPA Domain's Primary Library Server Machine ID
 * Web Server Protocol  * Web Server Protocol
 * Internet Domain Name of Your Institution  * Internet Domain Name of Your Institution
   * Hostname
 ===============================================================================  ===============================================================================
   
 In addition, a Support E-mail Address can also be included. If  In addition, a Support E-mail Address can also be included. If
Line 282  END Line 285  END
   }    }
 }  }
   
   
 # get domain description  # get domain description
 # 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 547  END Line 549  END
   }    }
 }  }
   
   # get hostname
   # accept if valid, if not valid, tell user and repeat
   $flag=0;
   my $posshostname;
   if (($hostname =~ /^[A-Za-z0-9\-]+$/) && ($intdom ne '')) {
       $posshostname = $hostname.'.'.$intdom;
   } 
   if (($hostname =~ /^[A-Za-z0-9\-]+\.[A-Za-z0-9\-]+/) &&
       ($hostname =~ /^[A-Za-z0-9.\-]+$/)) {
       $posshostname = $hostname;
   }
   while (!$flag) {
     print(&lt;&lt;END);
   
   ****** Hostname of the server/VM *****
   
   The hostname of the server/VM is required. This will be similar to:
   somename.ustate.edu or somename.department.ustate.edu, and would be 
   the web address which users would point their web browsers at to
   access the server.
   
   END
   
   if ($posshostname) {
       print "ENTER HOSTNAME OF SERVER [$posshostname]:\n";
   } else {
       print "ENTER HOSTNAME OF SERVER:\n";
   }
   
     my $choice=&lt;&gt;;
     chomp($choice);
     if (($choice =~ /^[A-Za-z0-9\-]+\.[A-Za-z0-9\-]+/) &&
         ($choice =~ /^[A-Za-z0-9.\-]+$/)) {
       open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
       print(OUT 'hostname'."\t".$choice."\n");
       close(OUT);
       $desiredhostname=$choice;
       $flag=1;
     } elsif (($choice eq '') && ($posshostname ne '')) {
       open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
       print(OUT 'hostname'."\t$posshostname\n");
       close(OUT);
       $desiredhostname = $posshostname;
       $flag = 1;
     } else {
       print "Invalid input (only letters, numbers, - and . allowed, with at least one .).\n";
     }
   }
   
 # update loncapa.conf  # update loncapa.conf
 my $confdir = '/etc/httpd/conf/';  my $confdir = '/etc/httpd/conf/';
Line 710  my %perlvarstatic; Line 760  my %perlvarstatic;
  }   }
     }      }
   
     if (!$protocol) {      if ((!$protocol) || (!$desiredhostname)) {
         foreach my $file (@hosts_files) {          foreach my $file (@hosts_files) {
             open(IN,'&lt;'.$file);              open(IN,'&lt;'.$file);
             while(my $line = &lt;IN&gt;) {              while(my $line = &lt;IN&gt;) {
                 if ($line =~ /^\Q$perlvar{'lonHostID'}\E:\Q$perlvar{'lonDefDomain'}\E\:(?:access|library)\:[^:]+\:(https?)/) {                  if ($line =~ /^\Q$perlvar{'lonHostID'}\E:\Q$perlvar{'lonDefDomain'}\E\:(?:access|library)\:([^:]+)\:(https?)/) {
                     $protocol = $1;                      if (!$desiredhostname) {
                     chomp($protocol);                          $desiredhostname = $1;
                       }
                       if (!$protocol) { 
                           $protocol = $2;
                           chomp($protocol);
                       }
                     last;                      last;
                 }                  }
             }              }
Line 767  my %perlvarstatic; Line 822  my %perlvarstatic;
     }      }
         
 # implement editing logic below, interactively  # implement editing logic below, interactively
 # update loncapa.conf until 14 is entered  # update loncapa.conf until 15 is entered
   
 my $flag=0;  my $flag=0;
   
Line 784  This is now the current configuration of Line 839  This is now the current configuration of
  6) Support E-mail Address: $perlvar{'lonSupportEMail'}   6) Support E-mail Address: $perlvar{'lonSupportEMail'}
  7) Web Server Protocol (http or https): $protocol    7) Web Server Protocol (http or https): $protocol 
  8) Internet Domain Name: $intdom    8) Internet Domain Name: $intdom 
  9) Role: $perlvar{'lonRole'}   9) Hostname: $desiredhostname
 10) Cache Expiration Time: $perlvar{'lonExpire'}  10) Role: $perlvar{'lonRole'}
 11) Server Load: $perlvar{'lonLoadLim'}  11) Cache Expiration Time: $perlvar{'lonExpire'}
 12) User Load: $perlvar{'lonUserLoadLim'}  12) Server Load: $perlvar{'lonLoadLim'}
 13) Allow only secure connections: $securestatus   13) User Load: $perlvar{'lonUserLoadLim'}
 14) Everything is correct up above  14) Allow only secure connections: $securestatus 
   15) Everything is correct up above
 END  END
   
 my @error;  my @error;
Line 855  if (!defined($primaryLibServer)) { Line 911  if (!defined($primaryLibServer)) {
   
 if (@error) { print "\n*** ERRORS: \n\t".join("\n\t",@error)."\n"; }  if (@error) { print "\n*** ERRORS: \n\t".join("\n\t",@error)."\n"; }
   print(&lt;&lt;END);    print(&lt;&lt;END);
 ENTER A CHOICE OF 1-13 TO CHANGE, otherwise ENTER 14:  ENTER A CHOICE OF 1-14 TO CHANGE, otherwise ENTER 15:
 END  END
 my $choice=&lt;&gt;;  my $choice=&lt;&gt;;
 chomp($choice);  chomp($choice);
Line 947  END Line 1003  END
   }    }
   elsif ($choice==9) {    elsif ($choice==9) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 9) Role: $perlvar{'lonRole'}  9) Hostname of Server/VM
   ENTER NEW VALUE:
   
   END
       my $choice2=&lt;&gt;;
       chomp($choice2);
       $desiredhostname=$choice2;
     }
   
     elsif ($choice==10) {
     print(&lt;&lt;END);
   10) 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 955  END Line 1022  END
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonRole'}=$choice2;      $perlvar{'lonRole'}=$choice2;
   }    }
   elsif ($choice==10) {    elsif ($choice==11) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 10) Cache Expiration Time: $perlvar{'lonExpire'}  11) 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==11) {    elsif ($choice==12) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 11) Server Load: $perlvar{'lonLoadLim'}  12) 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==12) {    elsif ($choice==13) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 12) User Load: $perlvar{'lonUserLoadLim'}  13) 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 983  END Line 1050  END
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonUserLoadLim'}=$choice2;      $perlvar{'lonUserLoadLim'}=$choice2;
   }    }
   elsif ($choice==13) {    elsif ($choice==14) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 13) Allow only secure connections: $securestatus   14) 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 1012  END Line 1079  END
     }      }
     ($securestatus,$securenum)=&securesetting(%perlvar);      ($securestatus,$securenum)=&securesetting(%perlvar);
   }    }
   elsif (($choice==14) && (!@error)) {    elsif (($choice==15) && (!@error)) {
     $flag=1;      $flag=1;
   }    }
   else {    else {
     print "Invalid input.\n";      print "Invalid input.\n";
   }    }
 }  }
   
     open(OUT,"&gt;$confdir$filename") or      open(OUT,"&gt;$confdir$filename") or
       die("Cannot output to $confdir$filename\n");        die("Cannot output to $confdir$filename\n");
     foreach my $key (keys %perlvar) {      foreach my $key (keys %perlvar) {
Line 1038  END Line 1106  END
 <target dist='default'>loncom/hosts.tab</target>  <target dist='default'>loncom/hosts.tab</target>
 <perlscript mode='fg'>  <perlscript mode='fg'>
 unless (-l "<TARGET />") {  unless (-l "<TARGET />") {
   my $hostname=`hostname -f`;chomp($hostname);    if ($desiredhostname eq '') { 
         my $hostname=`hostname -f`;chomp($hostname);
         $desiredhostname = $hostname;
     }
   my $date=`date -I`; chomp($date);    my $date=`date -I`; chomp($date);
   my $lonHostID=$perlvar{'lonHostID'};    my $lonHostID=$perlvar{'lonHostID'};
   $lonHostID=~s/[^\w\-.]//g;    $lonHostID=~s/[^\w\-.]//g;
   my $lineexistflag=0;    my $lineexistflag=0;
   my $hostidexistflag=0;    my $hostidexistflag=0;
   my $line2insert=&lt;&lt;END;    my $line2insert=&lt;&lt;END;
 $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$protocol:$intdom  $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$desiredhostname:$protocol:$intdom
 END  END
   if (!$domainTabExtras) {    if (!$domainTabExtras) {
  $domainTabExtras=':::::';   $domainTabExtras=':::::';
Line 1055  END Line 1126  END
     open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or      open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or
       die('file generation error');        die('file generation error');
       print(OUT $line2insert);        print(OUT $line2insert);
       print OUT ("^$hostname:$protocol\n");        print OUT ("^$desiredhostname:$protocol\n");
     close(OUT);      close(OUT);
     open(OUT,'&gt;../'.$lonCluster.'_dns_hosts.tab') or      open(OUT,'&gt;../'.$lonCluster.'_dns_hosts.tab') or
       die('file generation error');        die('file generation error');

Removed from v.1.83  
changed lines
  Added in v.1.84


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