From 3c504653a70dbc1284b1d8d9c8cd924815bee05c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Thu, 21 Nov 2019 16:19:30 +0100 Subject: [PATCH] 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 --- distgit_bugzilla_sync/script.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/distgit_bugzilla_sync/script.py b/distgit_bugzilla_sync/script.py index ee4bdda..d21289d 100644 --- a/distgit_bugzilla_sync/script.py +++ b/distgit_bugzilla_sync/script.py @@ -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']