Move retrieving the POC for each product to the data gathering part

This makes sense and allows the output of the script to be easier to
share.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2019-11-21 16:19:30 +01:00
parent 4a44a51ba5
commit 3c504653a7

View file

@ -582,6 +582,21 @@ class DistgitBugzillaSync:
products.add(self.env['namespace_to_product'][project['namespace']])
project['products'] = list(products)
products_poc = {}
for product in products:
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]
products_poc[product] = owner
project['products_poc'] = products_poc
self.pagure_projects[idx] = project
@cache.cache_on_arguments()
@ -662,6 +677,7 @@ class DistgitBugzillaSync:
if not self.pagure_projects:
return
if self.env["verbose"]:
times["data structure end"] = time.time()
delta = times["data structure end"] - times["start"]
@ -698,22 +714,11 @@ class DistgitBugzillaSync:
print(f"Ignoring: {product}/{project['name']}")
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:
bugzilla.add_edit_component(
package=project["name"],
collection=product,
owner=owner,
owner=project["products_poc"][product],
description=project['summary'],
qacontact=None,
cclist=project['watchers']