coren has uploaded a new change for review.
https://gerrit.wikimedia.org/r/218880
Change subject: Labs: small race condition fix in replica-addusers.pl
......................................................................
Labs: small race condition fix in replica-addusers.pl
Bug: T92561
Change-Id: I4a3dfe953962e18fdd418ab63a6af6c79259f9a7
---
M modules/openstack/files/replica-addusers.pl
1 file changed, 6 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/80/218880/1
diff --git a/modules/openstack/files/replica-addusers.pl
b/modules/openstack/files/replica-addusers.pl
index 38f1829..4a8b8a3 100755
--- a/modules/openstack/files/replica-addusers.pl
+++ b/modules/openstack/files/replica-addusers.pl
@@ -138,14 +138,16 @@
foreach my $dir (@homes) {
$pwfile = "$dir/replica.my.cnf";
- if(open MYCNF, ">$pwfile") {
- print "* creds for $username ($mysqlusr) added to $pwfile\n";
- chown $uid, $gid, $pwfile;
- chmod 0600, $pwfile;
+ $tmpfile = "/srv/project/.tmp.replica.my.cnf";
+ if(open MYCNF, ">$tmpfile") {
+ chown $uid, $gid, $tmpfile;
+ chmod 0600, $tmpfile;
print MYCNF "[client]\n";
print MYCNF "user='$mysqlusr'\n";
print MYCNF "password='$password'\n";
close MYCNF;
+ rename $tmpfile, $pwfile;
+ print "* creds for $username ($mysqlusr) added to $pwfile\n";
}
}
}
--
To view, visit https://gerrit.wikimedia.org/r/218880
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a3dfe953962e18fdd418ab63a6af6c79259f9a7
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