mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-03-24 09:21:11 +00:00
email: Ignore suspended LP people
We were looking at ~python-modules-team, which is suspended and raises a HTTPError that wasn't being caught.
This commit is contained in:
parent
c2de27c3b3
commit
272f41c4a5
@ -5,6 +5,7 @@ import math
|
||||
import socket
|
||||
import smtplib
|
||||
|
||||
from urllib.error import HTTPError
|
||||
from urllib.parse import unquote
|
||||
from collections import defaultdict
|
||||
|
||||
@ -117,6 +118,7 @@ class EmailPolicy(BasePolicy, Rest):
|
||||
if person in self.addresses:
|
||||
return self.addresses[person]
|
||||
addresses = []
|
||||
try:
|
||||
gpg = self.query_lp_rest_api(person + '/gpg_keys', {})
|
||||
for key in gpg['entries']:
|
||||
details = self.query_rest_api('http://keyserver.ubuntu.com/pks/lookup', {
|
||||
@ -140,10 +142,16 @@ class EmailPolicy(BasePolicy, Rest):
|
||||
addresses.append(match.group(1))
|
||||
address = self.addresses[person] = address_chooser(addresses)
|
||||
return address
|
||||
except HTTPError as e:
|
||||
if e.code != 410: # suspended user
|
||||
raise
|
||||
self.log('Ignoring person %s as suspended in Launchpad' % person)
|
||||
return None
|
||||
|
||||
def scrape_gpg_emails(self, people):
|
||||
"""Find email addresses from GPG keys."""
|
||||
return [self._scrape_gpg_emails(person) for person in (people or [])]
|
||||
emails = [self._scrape_gpg_emails(person) for person in (people or [])]
|
||||
return [email for email in emails if email is not None]
|
||||
|
||||
def lp_get_emails(self, pkg, version):
|
||||
"""Ask LP who uploaded this package."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user