Bring back the possibility to override the default assignee
This is doable for packages that are retired (and thus where the assignee is orphan) as well as per product: Fedora vs Fedora EPEL being the most common. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
69edb448be
commit
bce634b199
1 changed files with 29 additions and 16 deletions
|
@ -358,21 +358,6 @@ def send_email(fromAddress, toAddress, subject, message, ccAddress=None):
|
||||||
smtp.quit()
|
smtp.quit()
|
||||||
|
|
||||||
|
|
||||||
@cache.cache_on_arguments()
|
|
||||||
def _get_override_yaml(project, session):
|
|
||||||
pagure_override_url = '{0}/{1}/raw/master/f/{2}/{3}'.format(
|
|
||||||
env['pagure_url'].rstrip('/'), env['bugzilla']['override_repo'], project['namespace'],
|
|
||||||
project['name'])
|
|
||||||
|
|
||||||
if config["verbose"]:
|
|
||||||
print('Querying {0}'.format(pagure_override_url))
|
|
||||||
override_rv = session.get(pagure_override_url, timeout=30)
|
|
||||||
if override_rv.status_code == 200:
|
|
||||||
override_yaml = yaml.safe_load(override_rv.text)
|
|
||||||
return override_yaml.get('bugzilla_contact', {})
|
|
||||||
return {}
|
|
||||||
|
|
||||||
|
|
||||||
def _get_pdc_branches(session, repo):
|
def _get_pdc_branches(session, repo):
|
||||||
"""
|
"""
|
||||||
Gets the branches on a project. This function is used for mapping.
|
Gets the branches on a project. This function is used for mapping.
|
||||||
|
@ -585,6 +570,23 @@ class DistgitBugzillaSync:
|
||||||
|
|
||||||
self.pagure_projects[idx] = project
|
self.pagure_projects[idx] = project
|
||||||
|
|
||||||
|
@cache.cache_on_arguments()
|
||||||
|
def _get_override_yaml(self, project, session):
|
||||||
|
pagure_override_url = '{0}/{1}/raw/master/f/{2}/{3}'.format(
|
||||||
|
self.env['pagure_url'].rstrip('/'),
|
||||||
|
self.env['bugzilla']['override_repo'],
|
||||||
|
project['namespace'],
|
||||||
|
project['name'],
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.env["verbose"]:
|
||||||
|
print('Querying {0}'.format(pagure_override_url))
|
||||||
|
override_rv = session.get(pagure_override_url, timeout=30)
|
||||||
|
if override_rv.status_code == 200:
|
||||||
|
override_yaml = yaml.safe_load(override_rv.text)
|
||||||
|
return override_yaml.get('bugzilla_contact', {})
|
||||||
|
return {}
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
"""The entrypoint to the script."""
|
"""The entrypoint to the script."""
|
||||||
global envname, env, projects_dict
|
global envname, env, projects_dict
|
||||||
|
@ -661,11 +663,22 @@ class DistgitBugzillaSync:
|
||||||
print(f"Ignoring: {product}/{project['name']}")
|
print(f"Ignoring: {product}/{project['name']}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
owner = project["poc"]
|
||||||
|
# Check if the project is retired in PDC, and if so set assignee to orphan.
|
||||||
|
if _is_retired(product, project):
|
||||||
|
owner = 'orphan'
|
||||||
|
|
||||||
|
# Check if the Bugzilla ticket assignee has been manually overridden
|
||||||
|
override_yaml = self._get_override_yaml(project, self.session)
|
||||||
|
if override_yaml.get(product) \
|
||||||
|
and isinstance(override_yaml[product], str):
|
||||||
|
owner = override_yaml[product]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bugzilla.add_edit_component(
|
bugzilla.add_edit_component(
|
||||||
package=project["name"],
|
package=project["name"],
|
||||||
collection=product,
|
collection=product,
|
||||||
owner=project['poc'],
|
owner=owner,
|
||||||
description=project['summary'],
|
description=project['summary'],
|
||||||
qacontact=None,
|
qacontact=None,
|
||||||
cclist=project['watchers']
|
cclist=project['watchers']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue