Commit f604dc33 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Some cleanups and performance improvements:

* Be more selective about what lists are regenerated; we were generating
  way too many lists each time called. When calling from tbswap, use new
  -t option to generate just the active lists. When called from setgroups,
  use -p option to generate lists just for the project. Add update option
  for when user changes email address (and all lists really do need to be
  regenerated).

* Add "diff" processing. Instead of blindly firing each new list over to
  ops with ssh, store a copy of all of the lists in
  /usr/testbed/lists. After we generate the new list, diff it against the
  stored copy. If the same, skip it. Otherwise stash new copy and fire it
  over. This should reduce the wait times by quite a bit since the lists
  rarely change (except for the activity lists of course).

* Add -n (impotent) option for debugging; skips the ssh over to ops.

* Reorg a lot of stuff; it was getting hard to follow.
parent 3905bfe2
......@@ -303,7 +303,7 @@ sub AddUser()
fatal("Could not generate initial ssh key for $user");
}
# Add to elists.
system("$GENELISTS -n $user");
system("$GENELISTS -u $user");
#
# Must update the exports file or else nodes will complain. There
......@@ -374,7 +374,7 @@ sub DelUser()
system("$EXPORTSSETUP");
# Remove from elists.
system("$GENELISTS -n $user");
system("$GENELISTS -u $user");
$EUID = 0;
$sfsupdate = 1;
......@@ -472,7 +472,7 @@ sub UpdateUser(;$)
$EUID = $UID;
# Update elists in case email changed.
system("$GENELISTS -n $user");
system("$GENELISTS -m -u $user");
$EUID = 0;
return 0;
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -46,7 +46,8 @@ my $USERMOD = "/usr/sbin/pw usermod";
my $dbuid;
my @userlist;
my $pid="";
my $pid;
my $
my $user_name;
my $user_email;
my $logname;
......@@ -353,9 +354,17 @@ foreach my $uid (@userlist) {
TBNodeUpdateAccountsByUID($uid);
}
print "Updating email lists for: ".join(" ",@userlist)."\n";
foreach $u (@userlist) { system("$GENELISTS -n $u"); }
if (defined($pid)) {
print "Updating email lists for project $pid\n";
system("$GENELISTS -p $pid");
}
else {
print "Updating email lists for: ".join(" ",@userlist)."\n";
foreach $u (@userlist) {
system("$GENELISTS -n $u");
}
}
print "Group Update Completed!\n";
exit(0);
......
......@@ -507,7 +507,7 @@ sub doSwapout($) {
print "Resetting email lists.\n";
TBDebugTimeStamp("genelists started");
if (system("genelists")) {
if (system("genelists -t")) {
print "*** WARNING: Failed to reset email lists.\n";
}
TBDebugTimeStamp("genelists finished");
......@@ -801,7 +801,7 @@ sub doSwapin($) {
print "Setting up email lists.\n";
TBDebugTimeStamp("genelists started");
if (system("genelists")) {
if (system("genelists -t")) {
print STDERR "*** WARNING: Failed to update email lists.\n";
#
# This is a non-fatal error.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment