diff --git a/distgit_bugzilla_sync/script.py b/distgit_bugzilla_sync/script.py index 7789392..9f0bcce 100644 --- a/distgit_bugzilla_sync/script.py +++ b/distgit_bugzilla_sync/script.py @@ -162,26 +162,27 @@ class BugzillaProxy: # Old API -- in python-bugzilla. But with current server, this # gives ProxyError for collection, product in self.config["products"].items(): - self.product_cache[collection] = self.server.getcomponentsdetails(product) + bz_product_name = product.get('bz_product_name', collection) + self.product_cache[collection] = self.server.getcomponentsdetails(bz_product_name) elif self.config['bugzilla']['compat_api'] == 'component.get': # Way that's undocumented in the partner-bugzilla api but works # currently for collection, product in self.config["products"].items(): - + bz_product_name = product.get('bz_product_name', collection) # restrict the list of info returned to only the packages of # interest pkglist = [ project["name"] for project in pagure_projects - if product in project["products"] + if bz_product_name in project["products"] ] - products = {} + product_info_by_pkg = {} for pkg_segment in segment(pkglist, self.config['bugzilla']['req_segment']): # Format that bugzilla will understand. Strip None's that # segment() pads out the final data segment() with query = [ dict( - product=self.config['products'][collection], + product=bz_product_name, component=p ) for p in pkg_segment @@ -191,14 +192,14 @@ class BugzillaProxy: for package in raw_data['components']: # Reformat data to be the same as what's returned from # getcomponentsdetails - product = dict( + product_info = dict( initialowner=package['default_assignee'], description=package['description'], initialqacontact=package['default_qa_contact'], initialcclist=package['default_cc'] ) - products[package['name'].lower()] = product - self.product_cache[collection] = products + product_info_by_pkg[package['name'].lower()] = product_info + self.product_cache[collection] = product_info_by_pkg def invert_user_cache(self): """ Takes the user_cache built when querying FAS and invert it so @@ -314,6 +315,8 @@ class BugzillaProxy: e.args = ('ProtocolError', e.errcode, e.errmsg) raise + bz_product_name = self.config['products'][collection].get('bz_product_name', collection) + # Set the qacontact_email and name default_qa_contact_email = self.config['default_qa_contact_email'] default_qa_contact = f"" @@ -350,7 +353,7 @@ class BugzillaProxy: if data: # Changes occurred. Submit a request to change via xmlrpc - data['product'] = self.config['products'][collection] + data['product'] = bz_product_name data['component'] = package if self.config["verbose"]: @@ -414,16 +417,12 @@ class BugzillaProxy: new_poc=owner_email, prev_poc=product[pkg_key]['initialowner'], name=package, - product=self.config['products'][collection], + product=bz_product_name, ) else: if self.config.get("print-no-change"): - bz_product_name = self.config['products'][collection].get( - 'bz_product_name', collection - ) print(f"[NOCHANGE] {package}/{bz_product_name}") else: - bz_product_name = self.config['products'][collection].get('bz_product_name', collection) if retired: if self.config['verbose']: print(f"[NOADD] {bz_product_name}/{package} (is retired)")