Only report namespace mis-configuration once and not always
Basically, instead of reporting that the namespace did not exist for every package/component in that namespace, we now only report it once per namespace (but we still print the full info in the logs if verbose is enabled). Then, instead of always emailing the admins for mis-configurations, we'll only email them if there are other errors then these which will happen all the time due to the flatpaks and tests namespaces which do not exist in PDC and bugzilla. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
809b88e328
commit
74a550ecd3
1 changed files with 14 additions and 6 deletions
|
@ -937,11 +937,16 @@ class DistgitBugzillaSync:
|
|||
if project["namespace"] not in self.env["pdc_types"]:
|
||||
project["branches"] = []
|
||||
project["products"] = []
|
||||
self.errors["configuration"].append(
|
||||
f'Namespace `{project["namespace"]}` not found in the pdc_type '
|
||||
f'configuration key, project {project["namespace"]}/{project["name"]} '
|
||||
"ignored"
|
||||
)
|
||||
error = f'Namespace `{project["namespace"]}` not found in the pdc_type ' \
|
||||
f'configuration key -- ignoring it'
|
||||
if not error in self.errors["configuration"]:
|
||||
self.errors["configuration"].append(error)
|
||||
if self.env["verbose"]:
|
||||
print(
|
||||
f'Namespace `{project["namespace"]}` not found in the pdc_type '
|
||||
f'configuration key, project {project["namespace"]}/{project["name"]} '
|
||||
"ignored"
|
||||
)
|
||||
continue
|
||||
|
||||
pdc_type = self.env["pdc_types"][project["namespace"]]
|
||||
|
@ -1156,7 +1161,10 @@ class DistgitBugzillaSync:
|
|||
if self.env["verbose"] or self.env["dryrun"]:
|
||||
print("*" * 80)
|
||||
print("\n".join(report))
|
||||
if not self.env["dryrun"]:
|
||||
|
||||
# Do not send the email in dryrun or when the error only relates to
|
||||
# configuration (which will always happen for flatpaks and tests)
|
||||
if not self.env["dryrun"] and list(self.errors.keys()) != ["configuration"]:
|
||||
self.send_email(
|
||||
self.env["email"]["from"],
|
||||
self.env["email"]["notify_admins"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue