coren has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/227324

Change subject: Labs: Ignore users with no home when adding DB users
......................................................................

Labs: Ignore users with no home when adding DB users

(So that only users that have logged in somewhere are added,
ignoring most spam accounts, etc)

Change-Id: I743871ad27361083a7b5a8418f907dfe2e01d237
---
M modules/labstore/files/replica-addusers.pl
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/24/227324/1

diff --git a/modules/labstore/files/replica-addusers.pl 
b/modules/labstore/files/replica-addusers.pl
index 3640c61..5b0a3d9 100755
--- a/modules/labstore/files/replica-addusers.pl
+++ b/modules/labstore/files/replica-addusers.pl
@@ -67,12 +67,14 @@
     my $dbopen = 0;
     my @projects = glob "/srv/project/*";
     my %allhomes;
+    my %userhomes;
     print "[enumerating homes]\n";
     foreach my $dir (glob("/srv/project/*/home/*"), 
glob("/srv/project/*/project/*")) {
         next if -f "$dir/replica.my.cnf";
         my @sd = stat $dir;
         next unless $#sd > -1;
         $allhomes{$dir} = $sd[4]; # uid
+       $userhomes{$sd[4]} = 1;
     }
 
     print "[enumerating users]\n";
@@ -80,6 +82,7 @@
     while(<PW>) {
         my ($username, undef, $uid, $gid, undef, $home, undef) = split /:/;
         next if $uid < 500;
+       next unless defined $userhomes{$uid};
         my @homes;
         $home =~ s/\/$//;
         $home = $1  if $home =~ m[^/data(/project/.*)$];

-- 
To view, visit https://gerrit.wikimedia.org/r/227324
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I743871ad27361083a7b5a8418f907dfe2e01d237
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: coren <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to