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:
|
except KeyError:
|
||||||
if username.startswith('@'):
|
if username.startswith('@'):
|
||||||
group = self.fas.group_by_name(username[1:])
|
group = self.fas.group_by_name(username[1:])
|
||||||
|
bz_email = group.mailing_list
|
||||||
|
if bz_email is None:
|
||||||
|
return
|
||||||
self.userCache[username] = {
|
self.userCache[username] = {
|
||||||
'bugzilla_email': group.mailing_list}
|
'bugzilla_email': bz_email}
|
||||||
else:
|
else:
|
||||||
person = self.fas.person_by_username(username)
|
person = self.fas.person_by_username(username)
|
||||||
bz_email = person.get('bugzilla_email', None)
|
bz_email = person.get('bugzilla_email', None)
|
||||||
if bz_email is None:
|
if bz_email is None:
|
||||||
print('%s has no bugzilla email, valid account?'
|
|
||||||
% username)
|
return
|
||||||
else:
|
self.userCache[username] = {'bugzilla_email': bz_email}
|
||||||
self.userCache[username] = {'bugzilla_email': bz_email}
|
|
||||||
return self.userCache[username]['bugzilla_email'].lower()
|
return self.userCache[username]['bugzilla_email'].lower()
|
||||||
|
|
||||||
def add_edit_component(self, package, collection, owner, description=None,
|
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.
|
'''Add or update a component to have the values specified.
|
||||||
'''
|
'''
|
||||||
# Turn the cclist into something usable by bugzilla
|
# Turn the cclist into something usable by bugzilla
|
||||||
initialCCList = list()
|
initialCCList = []
|
||||||
if 'people' in cclist:
|
if cclist and 'people' in cclist:
|
||||||
user_cc = [
|
for cc in cclist["people"]:
|
||||||
self._get_bugzilla_email(cc) for cc in cclist['people']]
|
bz_email = self._get_bugzilla_email(cc)
|
||||||
initialCCList.extend(user_cc)
|
if bz_email:
|
||||||
if 'groups' in cclist:
|
initialCCList.append(bz_email)
|
||||||
group_cc = [
|
else:
|
||||||
self._get_bugzilla_email(cc) for cc in cclist['groups']]
|
print(f"** {cc} has no bugzilla_email or mailing_list set **")
|
||||||
initialCCList.extend(group_cc)
|
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
|
# Add owner to the cclist so comaintainers taking over a bug don't
|
||||||
# have to do this manually
|
# have to do this manually
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue