jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/657536 )

Change subject: [IMPR] format db_hostname the same as db_name
......................................................................

[IMPR] format db_hostname the same as db_name

The current Wiki Replicas setup allows querrying any db replica from any
host since all of the wikis are one all of the hosts.
With the 2020 redesign each host will only have some wikis, so format
the hostname with the database name.

db_hostname is replaced by db_hostname_format.

Change-Id: Ife681250a279577b79ad80f7a9aa42b069ad4bb6
---
M pywikibot/config2.py
M pywikibot/data/mysql.py
2 files changed, 4 insertions(+), 3 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 00d3b50..644d63b 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -113,6 +113,7 @@
     'available_ssl_project', 'fake_user_agent', 'interwiki_contents_on_disk',
     'line_separator', 'LS', 'panoramio', 'proxy', 'special_page_limit',
     'sysopnames', 'use_mwparserfromhell', 'use_SSL_onlogin', 'use_SSL_always',
+    'db_hostname',
 }
 _future_variables = {'absolute_import', 'division', 'unicode_literals'}

@@ -689,10 +690,10 @@
 # db_name_format can be used to manipulate the dbName of site.
 #
 # Example for a pywikibot running on wmflabs:
-# db_hostname = 'enwiki.analytics.db.svc.eqiad.wmflabs'
+# db_hostname_format = '{0}.analytics.db.svc.eqiad.wmflabs'
 # db_name_format = '{0}_p'
 # db_connect_file = user_home_path('replica.my.cnf')
-db_hostname = 'localhost'
+db_hostname_format = 'localhost'
 db_username = ''
 db_password = ''
 db_name_format = '{0}'
diff --git a/pywikibot/data/mysql.py b/pywikibot/data/mysql.py
index 3f5d4d5..956b9d0 100644
--- a/pywikibot/data/mysql.py
+++ b/pywikibot/data/mysql.py
@@ -56,7 +56,7 @@
     else:
         credentials = {'read_default_file': config.db_connect_file}

-    with closing(pymysql.connect(config.db_hostname,
+    with closing(pymysql.connect(config.db_hostname_format.format(dbname),
                                  db=config.db_name_format.format(dbname),
                                  port=config.db_port,
                                  charset='utf8',

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/657536
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ife681250a279577b79ad80f7a9aa42b069ad4bb6
Gerrit-Change-Number: 657536
Gerrit-PatchSet: 2
Gerrit-Owner: JJMC89 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to