Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/295564
Change subject: [NOT FOR MERGING] hack maintain-replicas.pl for adywiki/jamwiki ...................................................................... [NOT FOR MERGING] hack maintain-replicas.pl for adywiki/jamwiki - Get credentials from DB_USER and DB_PASS envvars instead of trying to parse (incorrectly) ~/.my.cnf. - Don't process any wikis except adywiki and jamwiki - Print SQL statements on STDERR, so they can be captured and replayed. - Replace the labs dbs with localhost. Undo this hack to run on labs dbs. Bug: T135029 Change-Id: Ib5c28e4d9ccfbf5b76223d667eb43a7b1121efc2 --- M maintain-replicas/maintain-replicas.pl 1 file changed, 10 insertions(+), 28 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/software refs/changes/64/295564/1 diff --git a/maintain-replicas/maintain-replicas.pl b/maintain-replicas/maintain-replicas.pl index c38d77a..f97702a 100755 --- a/maintain-replicas/maintain-replicas.pl +++ b/maintain-replicas/maintain-replicas.pl @@ -54,9 +54,10 @@ } my %slices = ( - 'c1' => [ 'labsdb1001.eqiad.wmnet', 3306 ], - 'c2' => [ 'labsdb1002.eqiad.wmnet', 3306 ], - 'c3' => [ 'labsdb1003.eqiad.wmnet', 3306 ], + 'c1' => [ 'localhost', 3306 ], + # 'c1' => [ 'labsdb1001.eqiad.wmnet', 3306 ], + # 'c2' => [ 'labsdb1002.eqiad.wmnet', 3306 ], + # 'c3' => [ 'labsdb1003.eqiad.wmnet', 3306 ], ); my @fullviews = ( @@ -335,24 +336,8 @@ 'group' => 'wl_namespace, wl_title having wl_count >= 30', }, ); -my $dbuser; -my $dbpassword; -my $mycnf = $ENV{'HOME'} . "/.my.cnf"; -if(open MYCNF, "<$mycnf") { - my $client = 0; - while(<MYCNF>) { - if(m/^\[client\]\s*$/) { - $client = 1; - next; - } - $client = 0 if m/^\[/; - next unless $client; - $dbuser = $1 if m/^\s*user\s*=\s*'(.*)'\s*$/; - $dbpassword = $1 if m/^\s*password\s*=\s*'(.*)'\s*$/; - } - close MYCNF; -} -die "No credentials for connecting to databases.\n" unless defined $dbuser and defined $dbpassword; +my $dbuser = $ENV{'DB_USER'}; +my $dbpassword = $ENV{'DB_PASS'}; chdir "mediawiki-config"; @@ -360,12 +345,8 @@ my %db; -open ALL, "<dblists/all.dblist" or die "all.dblist: $!"; -while(<ALL>) { - chomp; - $db{$_} = {}; -} -close ALL; +$db{'adywiki'} = {}; +$db{'jamwiki'} = {}; sub dbprop($$$) { my($list, $prop, $val) = @_; @@ -401,7 +382,6 @@ # exposed through the API so we have to hardcode it here to match # what is in InitialiseSettings.php dbprop "wiktionary", "sensitive", 1; -$db{'jbowiki'}->{'sensitive'} = 1; open IS, "<wmf-config/InitialiseSettings.php" or die "InitializeSettings.php: $!\n"; my $curvar = undef; @@ -429,6 +409,7 @@ foreach my $dbk (keys %db) { my $db = $db{$dbk}; + next if $dbk !~ m/(ady|jam)wiki/; next if defined $db->{'deleted'}; next if defined $db->{'private'}; my $canon = $canonical{$dbk}; @@ -473,6 +454,7 @@ sub sql($) { my ($query) = @_; + print STDERR "$query\n"; return $dbh->do($query); } -- To view, visit https://gerrit.wikimedia.org/r/295564 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib5c28e4d9ccfbf5b76223d667eb43a7b1121efc2 Gerrit-PatchSet: 1 Gerrit-Project: operations/software Gerrit-Branch: master Gerrit-Owner: Ori.livneh <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits