Drop the bz_product_name override

Instead of having a product name and an override via the bz_product_name
just use always the product name.

This fixes the issue around "Fedora Container Images" which were somehow
not cached from bugzilla. This led to the script trying to create them
instead of updating them, which of course failed since they did exist
in bugzilla.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2020-08-20 12:48:14 +02:00
parent 438b5c806d
commit 6428a58b06
2 changed files with 13 additions and 17 deletions

View file

@ -14,9 +14,9 @@ ignorable_accounts = ["packagerbot", "zuul"]
namespace = "rpms" namespace = "rpms"
versions = ["rawhide", "31", "30", "29"] versions = ["rawhide", "31", "30", "29"]
[products."Fedora Container"] [products."Fedora Container"]
[products."Fedora Container Images"]
namespace = "container" namespace = "container"
versions = ["rawhide", "29"] versions = ["rawhide", "29"]
bz_product_name = "Fedora Container Images"
[products."Fedora Modules"] [products."Fedora Modules"]
namespace = "modules" namespace = "modules"
versions = [] versions = []

View file

@ -177,22 +177,21 @@ class BugzillaProxy:
# Old API -- in python-bugzilla. But with current server, this # Old API -- in python-bugzilla. But with current server, this
# gives ProxyError # gives ProxyError
for collection, product in self.config["products"].items(): for collection, product in self.config["products"].items():
bz_product_name = product.get("bz_product_name", collection)
self.product_cache[collection] = self.server.getcomponentsdetails( self.product_cache[collection] = self.server.getcomponentsdetails(
bz_product_name collection
) )
elif self.config["bugzilla"]["compat_api"] == "component.get": elif self.config["bugzilla"]["compat_api"] == "component.get":
# Way that's undocumented in the partner-bugzilla api but works # Way that's undocumented in the partner-bugzilla api but works
# currently # currently
chunk = self.config["bugzilla"]["req_segment"] chunk = self.config["bugzilla"]["req_segment"]
for collection, product in self.config["products"].items(): 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 # restrict the list of info returned to only the packages of
# interest # interest
pkglist = [ pkglist = [
project["name"] project["name"]
for project in pagure_projects for project in pagure_projects
if bz_product_name in project["products"] if collection in project["products"]
] ]
product_info_by_pkg = {} product_info_by_pkg = {}
estimated_size = math.ceil(len(pkglist) / chunk) estimated_size = math.ceil(len(pkglist) / chunk)
@ -200,13 +199,13 @@ class BugzillaProxy:
# Format that bugzilla will understand. Strip None's that # Format that bugzilla will understand. Strip None's that
# segment() pads out the final data segment() with # segment() pads out the final data segment() with
query = [ query = [
{"product": bz_product_name, "component": p} {"product": collection, "component": p}
for p in pkg_segment for p in pkg_segment
if p is not None if p is not None
] ]
if self.config["verbose"]: if self.config["verbose"]:
print( print(
f" - Querying product `{bz_product_name}`, " f" - Querying product `{collection}`, "
f"query {cnt} of {estimated_size}" f"query {cnt} of {estimated_size}"
) )
raw_data = _query_component(query) raw_data = _query_component(query)
@ -384,9 +383,6 @@ class BugzillaProxy:
e.args = ("ProtocolError", e.errcode, e.errmsg) e.args = ("ProtocolError", e.errcode, e.errmsg)
raise raise
bz_product_name = self.config["products"][collection].get(
"bz_product_name", collection
)
# Set the qacontact_email and name # Set the qacontact_email and name
default_qa_contact_email = self.config["default_qa_contact_email"] default_qa_contact_email = self.config["default_qa_contact_email"]
@ -431,7 +427,7 @@ class BugzillaProxy:
if data: if data:
# Changes occurred. Submit a request to change via xmlrpc # Changes occurred. Submit a request to change via xmlrpc
data["product"] = bz_product_name data["product"] = collection
data["component"] = package data["component"] = package
if self.config["verbose"]: if self.config["verbose"]:
@ -535,21 +531,21 @@ class BugzillaProxy:
new_poc=owner_email, new_poc=owner_email,
prev_poc=product[pkg_key]["initialowner"], prev_poc=product[pkg_key]["initialowner"],
name=package, name=package,
product=bz_product_name, product=collection,
print_fas_names=print_fas_names, print_fas_names=print_fas_names,
) )
else: else:
if self.config.get("print-no-change"): if self.config.get("print-no-change"):
print(f"[NOCHANGE] {package}/{bz_product_name}") print(f"[NOCHANGE] {package}/{collection}")
else: else:
if retired: if retired:
if self.config["verbose"]: if self.config["verbose"]:
print(f"[NOADD] {bz_product_name}/{package} (is retired)") print(f"[NOADD] {collection}/{package} (is retired)")
return return
# Add component # Add component
data = { data = {
"product": bz_product_name, "product": collection,
"component": package, "component": package,
"description": description or "NA", "description": description or "NA",
"initialowner": owner_email, "initialowner": owner_email,
@ -579,12 +575,12 @@ class BugzillaProxy:
else: else:
value = initial_cc_fasnames value = initial_cc_fasnames
print( print(
f"[ADDCOMP] {bz_product_name}/{package}" f"[ADDCOMP] {collection}/{package}"
f" {key} set to FAS name(s) `{value}`" f" {key} set to FAS name(s) `{value}`"
) )
else: else:
print( print(
f"[ADDCOMP] {bz_product_name}/{package}" f"[ADDCOMP] {collection}/{package}"
f" {key} set to {data.get(key)}" f" {key} set to {data.get(key)}"
) )