Stop trying to assign Launchpad bugs
Gerrit 2.15 and later no longer stores account information in an
RDBMS, so querying it to determine potential mapping to Launchpad
accounts is not possible. As a stopgap, just stop trying to assign
bugs when setting their state to in-progress, but still perform the
other expected tasks.
This functionality should be considered deprecated, and would be
better replaced with a Zuul job for future maintainability and
extensibility.
Change-Id: I1e08ed0dfa62a1d59084a19d87e3af317dabad04
Depends-On: https://review.opendev.org/782603
diff --git a/jeepyb/cmd/update_bug.py b/jeepyb/cmd/update_bug.py
index b756304..34be79e 100644
--- a/jeepyb/cmd/update_bug.py
+++ b/jeepyb/cmd/update_bug.py
@@ -25,7 +25,6 @@
from launchpadlib import launchpad
from launchpadlib import uris
-import jeepyb.gerritdb
from jeepyb import projects as p
from jeepyb import utils as u
@@ -82,51 +81,8 @@
bugtask.bug.newMessage(subject=subject, content=body)
-def set_in_progress(bugtask, launchpad, uploader, change_url):
- """Set bug In progress with assignee being the uploader"""
-
- # Retrieve uploader from Launchpad by correlating Gerrit E-mail
- # address to OpenID, and only set if there is a clear match.
- try:
- searchkey = uploader[uploader.rindex("(") + 1:-1]
- except ValueError:
- searchkey = uploader
-
- # The counterintuitive query is due to odd database schema choices
- # in Gerrit. For example, an account with a secondary E-mail
- # address added looks like...
- # select email_address,external_id from account_external_ids
- # where account_id=1234;
- # +-----------------+-----------------------------------------+
- # | email_address | external_id |
- # +-----------------+-----------------------------------------+
- # | plugh@xyzzy.com | https://login.ubuntu.com/+id/fR0bnU1 |
- # | bar@foo.org | mailto:bar@foo.org |
- # | NULL | username:quux |
- # +-----------------+-----------------------------------------+
- # ...thus we need a join on a secondary query to search against
- # all the user's configured E-mail addresses.
- #
- # Worse, we also need to filter by active accounts only since
- # picking an inactive account could result in using the wrong
- # OpenId entirely.
- #
- query = """SELECT t.external_id FROM account_external_ids t
- INNER JOIN (
- SELECT t.account_id FROM account_external_ids t
- WHERE t.email_address = %s )
- original ON t.account_id = original.account_id
- AND t.external_id LIKE 'https://login.ubuntu.com%%'
- JOIN accounts a ON a.account_id = t.account_id
- WHERE a.inactive = 'N'"""
-
- cursor = jeepyb.gerritdb.connect().cursor()
- cursor.execute(query, searchkey)
- data = cursor.fetchone()
- if data:
- assignee = launchpad.people.getByOpenIDIdentifier(identifier=data[0])
- if assignee:
- bugtask.assignee = assignee
+def set_in_progress(bugtask, launchpad, change_url):
+ """Set bug In progress"""
bugtask.status = "In Progress"
bugtask.lp_save()