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

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