Volans has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/345298 )
Change subject: Fix database selection in tendril task
......................................................................
Fix database selection in tendril task
Bug: T160178
Change-Id: I7d40de372c3a01d72ce88b68ff11136860d887ed
---
M switchdc/lib/mysql.py
M switchdc/stages/t09_tendril.py
2 files changed, 4 insertions(+), 4 deletions(-)
Approvals:
jenkins-bot: Verified
Jcrespo: Looks good to me, but someone else must approve
Volans: Looks good to me, approved
diff --git a/switchdc/lib/mysql.py b/switchdc/lib/mysql.py
index ba58ddc..7748562 100644
--- a/switchdc/lib/mysql.py
+++ b/switchdc/lib/mysql.py
@@ -9,14 +9,14 @@
"""Custom exception class for errors of this module."""
-def get_query_command(query):
+def get_query_command(query, database=''):
"""Return the command to be executed for a given query.
Arguments:
query -- the mysql query to be executed. Double quotes must be
already escaped
- column_names -- wheter to include the column names or not in the output.
[optional, default: False]
+ database -- an optional database to connect to before executing the
query. [optional, default: '']
"""
- return 'mysql --skip-ssl --skip-column-names --batch -e
"{query}"'.format(query=query)
+ return 'mysql --skip-ssl --skip-column-names --batch -e "{query}"
{database}'.format(query=query).strip()
def get_db_remote(dc, **kwargs):
diff --git a/switchdc/stages/t09_tendril.py b/switchdc/stages/t09_tendril.py
index e81652f..8665270 100644
--- a/switchdc/stages/t09_tendril.py
+++ b/switchdc/stages/t09_tendril.py
@@ -20,6 +20,6 @@
master = remote.hosts[0]
commands.append(mysql.get_query_command(
("UPDATE shards SET master_id = (SELECT id FROM servers WHERE host
= '{master}') WHERE"
- "name = '{shard}'").format(master=master, shard=shard)))
+ "name = '{shard}'").format(master=master, shard=shard),
database='tendril'))
tendril.sync(*commands)
--
To view, visit https://gerrit.wikimedia.org/r/345298
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7d40de372c3a01d72ce88b68ff11136860d887ed
Gerrit-PatchSet: 3
Gerrit-Project: operations/switchdc
Gerrit-Branch: master
Gerrit-Owner: Volans <[email protected]>
Gerrit-Reviewer: Jcrespo <[email protected]>
Gerrit-Reviewer: Volans <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits