Page MenuHomePhabricator

plagiabot cannot connect to toolsdb using connect file
Closed, DeclinedPublicBUG REPORT

Description

Traceback (most recent call last):
  File "/data/project/eranbot/gitPlagiabot/plagiabot/plagiabot.py", line 864, in <module>
    main()
  File "/data/project/eranbot/gitPlagiabot/plagiabot/plagiabot.py", line 859, in main
    bot.run()
  File "/data/project/eranbot/gitPlagiabot/plagiabot/plagiabot.py", line 620, in run
    self.report_uploads()  # report checked edits
  File "/data/project/eranbot/gitPlagiabot/plagiabot/plagiabot.py", line 513, in report_uploads
    self.report_log.add_report(rep['new'], rep['diff_date'], rep['title_no_ns'], rep['ns'], rep['report_id'], rep['source'])
  File "/mnt/nfs/labstore-secondary-tools-project/eranbot/gitPlagiabot/plagiabot/report_logger.py", line 82, in add_report
    self.connect()  # TODO: handle InterfaceError: Can't connect to MySQL server...?
  File "/mnt/nfs/labstore-secondary-tools-project/eranbot/gitPlagiabot/plagiabot/report_logger.py", line 75, in connect
    charset="utf8")
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 86, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 204, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (1045, "Access denied for user 'tools.eranbot'@'172.16.6.137' (using password: NO)")

Event Timeline

Restricted Application added subscribers: Cyberpower678, Aklapper. · View Herald Transcript
JJMC89 removed a subscriber: Cyberpower678.

I've applied the below hotfix and restarted the enwiki job.

diff --git a/report_logger.py b/report_logger.py
index 8d39e31..92e4cb4 100644
--- a/report_logger.py
+++ b/report_logger.py
@@ -70,7 +70,8 @@ class DbReportLogger(ReportLogger):
     def connect(self):
         self.conn = MySQLdb.connect(host=dbsettings.reporter_db_host,
                                     db='{}__copyright_p'.format(config.db_username),
-                                    read_default_file=config.db_connect_file,
+                                    user=config.db_username,
+                                    passwd=config.db_password,
                                     use_unicode=True,
                                     charset="utf8")
         self.cursor = self.conn.cursor()

We have a new report now (https://copypatrol.toolforge.org/en/?id=85151921). I don't know why using the connect file isn't working though.

The bot has stopped again - no new reports for over 4 hours. Thanks.

MusikAnimal subscribed.

I've applied the below hotfix and restarted the enwiki job.

Thanks for the hotfix! I think it's fine to commit this to the repo so the changes aren't lost. In fact, when I first attempted to move plagiabot to the copypatrol account (T306888#7931423) I needed to pull the credentials from the config file rather than using the connect file, since we'd need to use eranbot's credentials and not copypatrol's. So I think your hotfix is a good change to make, regardless.

plagiabot is no longer in use.