Deal with users or groups not having the expected email address
An user could have no "bugzilla_email" set and a group no "mailing_list" address set, both of which are expected to sync the ACLs to bugzilla. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
1f75496059
commit
d61e83a157
1 changed files with 22 additions and 14 deletions
|
@ -199,16 +199,18 @@ class BugzillaProxy:
|
|||
except KeyError:
|
||||
if username.startswith('@'):
|
||||
group = self.fas.group_by_name(username[1:])
|
||||
bz_email = group.mailing_list
|
||||
if bz_email is None:
|
||||
return
|
||||
self.userCache[username] = {
|
||||
'bugzilla_email': group.mailing_list}
|
||||
'bugzilla_email': bz_email}
|
||||
else:
|
||||
person = self.fas.person_by_username(username)
|
||||
bz_email = person.get('bugzilla_email', None)
|
||||
if bz_email is None:
|
||||
print('%s has no bugzilla email, valid account?'
|
||||
% username)
|
||||
else:
|
||||
self.userCache[username] = {'bugzilla_email': bz_email}
|
||||
|
||||
return
|
||||
self.userCache[username] = {'bugzilla_email': bz_email}
|
||||
return self.userCache[username]['bugzilla_email'].lower()
|
||||
|
||||
def add_edit_component(self, package, collection, owner, description=None,
|
||||
|
@ -216,15 +218,21 @@ class BugzillaProxy:
|
|||
'''Add or update a component to have the values specified.
|
||||
'''
|
||||
# Turn the cclist into something usable by bugzilla
|
||||
initialCCList = list()
|
||||
if 'people' in cclist:
|
||||
user_cc = [
|
||||
self._get_bugzilla_email(cc) for cc in cclist['people']]
|
||||
initialCCList.extend(user_cc)
|
||||
if 'groups' in cclist:
|
||||
group_cc = [
|
||||
self._get_bugzilla_email(cc) for cc in cclist['groups']]
|
||||
initialCCList.extend(group_cc)
|
||||
initialCCList = []
|
||||
if cclist and 'people' in cclist:
|
||||
for cc in cclist["people"]:
|
||||
bz_email = self._get_bugzilla_email(cc)
|
||||
if bz_email:
|
||||
initialCCList.append(bz_email)
|
||||
else:
|
||||
print(f"** {cc} has no bugzilla_email or mailing_list set **")
|
||||
if cclist and 'groups' in cclist:
|
||||
for cc in cclist["groups"]:
|
||||
bz_email = self._get_bugzilla_email(cc)
|
||||
if bz_email:
|
||||
initialCCList.append(bz_email)
|
||||
else:
|
||||
print(f"** {cc} has no mailing-list set in FAS! **")
|
||||
|
||||
# Add owner to the cclist so comaintainers taking over a bug don't
|
||||
# have to do this manually
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue