jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/336171 )
Change subject: Do not hardcore database hosts in list-user-databases ...................................................................... Do not hardcore database hosts in list-user-databases The database host that served c2.labsdb was decommissioned and is no longer accessible. This causes list-user-databases to fail because c2.labsdb is in the hardcoded list of database servers to check for a user's databases. There is no easy authoritative source for a list of active database servers; role::labs::db::maintain_dbusers lists all database servers, but does not differentiate between hosts that are accessible from the Labs network and hosts that are firewalled. Therefore this change removes the hardcoded list completely and instead requires that list-user-databases is called with an explicit list of database servers to check for a user's database. For the active database servers current at the time of this change, list-user-databases would be invoked as: | $ list-user-databases -H labsdb1001.eqiad.wmnet \ | -H labsdb1003.eqiad.wmnet \ | -H labsdb1005.eqiad.wmnet \ | /path/to/replica.my.cnf Change-Id: I861375502a04a839db69fa1b92e4acfecf6470e1 --- M debian/changelog M misctools/list-user-databases M misctools/list-user-databases.1.in 3 files changed, 23 insertions(+), 10 deletions(-) Approvals: Tim Landscheidt: Looks good to me, approved jenkins-bot: Verified diff --git a/debian/changelog b/debian/changelog index c6f5d53..b43d6cf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ toollabs (1.19~dev) unstable; urgency=medium * Remove toolwatcher + * Do not hardcore database hosts in list-user-databases - -- Tim Landscheidt <t...@tim-landscheidt.de> Tue, 07 Feb 2017 15:57:45 +0000 + -- Tim Landscheidt <t...@tim-landscheidt.de> Sun, 26 Feb 2017 00:15:16 +0000 toollabs (1.18) unstable; urgency=medium diff --git a/misctools/list-user-databases b/misctools/list-user-databases index cc9f374..5dc81eb 100755 --- a/misctools/list-user-databases +++ b/misctools/list-user-databases @@ -7,12 +7,13 @@ import mysql.connector -# Servers to search databases on. -DATABASE_SERVERS = ('c1.labsdb', 'c2.labsdb', 'c3.labsdb', 'tools.labsdb') - if __name__ == '__main__': # Get list of defaults files to extract user information from. parser = argparse.ArgumentParser(description='List databases owned by users, given by the credentials files.') + parser.add_argument('-H', '--host', + action='append', + required=True, + help='database hosts to check') parser.add_argument('mycnffilenames', metavar='MYCNFFILENAME', nargs='+', @@ -25,7 +26,7 @@ username = c.get('client', 'user').strip("'") password = c.get('client', 'password').strip("'") databases_found = [] - for server in DATABASE_SERVERS: + for server in args.host: conn = mysql.connector.connect(user=username, password=password, host=server, diff --git a/misctools/list-user-databases.1.in b/misctools/list-user-databases.1.in index d32ec71..0af7574 100644 --- a/misctools/list-user-databases.1.in +++ b/misctools/list-user-databases.1.in @@ -2,16 +2,27 @@ .SH NAME list-user-databases \- list databases a MySQL account has access to .SH SYNOPSIS -.B list-user-databases +.B list-user-databases -H +.I host +.RB [ -H +.I host +\[char46]..] .I filename -.RI [filename ...] +.RI [ filename +\[char46]..] .SH DESCRIPTION .B list-user-databases -lists all databases on the replica servers and -.I tools.labsdb -that the user has access to whose +lists all databases on the given database servers that the user has +access to whose .I replica.my.cnf file has been given as a command line argument. + +A list of potential database servers to check against can be gathered +from +.IR operation/puppet 's +.IR modules/role/manifests/labs/db/maintain_dbusers.pp . +Note that some of the database servers listed there are not accessible +from Labs and connection attempts will time out. .SH EXIT STATUS In case of success, .B list-user-databases -- To view, visit https://gerrit.wikimedia.org/r/336171 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I861375502a04a839db69fa1b92e4acfecf6470e1 Gerrit-PatchSet: 2 Gerrit-Project: labs/toollabs Gerrit-Branch: master Gerrit-Owner: Tim Landscheidt <t...@tim-landscheidt.de> Gerrit-Reviewer: Coren <m...@uberbox.org> Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl> Gerrit-Reviewer: Tim Landscheidt <t...@tim-landscheidt.de> Gerrit-Reviewer: Yuvipanda <yuvipa...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits