Yuvipanda has submitted this change and it was merged.
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(-)
Approvals:
Yuvipanda: Looks good to me, approved
jenkins-bot: Verified
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: merged
Gerrit-Change-Id: I743871ad27361083a7b5a8418f907dfe2e01d237
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: coren <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits