fix: fix update_zuul_project_config script #57

Closed
gtema wants to merge 1 commits from fix-update-zuul into main
2 changed files with 9 additions and 2 deletions

View File

@ -4,4 +4,4 @@
stestr>=2.0.0 # Apache-2.0
testtools>=2.2.0 # MIT
flake8
flake8>=6.0

View File

@ -149,8 +149,9 @@ def process_repositories(args, service):
"-hc-int-jobs" if args.environment == "internal" else "-hc-jobs"
)
for doc in data.docs_by_service_type(service["service_type"]):
logging.debug(f"Analyzing document {doc}")
logging.info("Analyzing document %s" % doc)
Review

Is there a reason to use the string literal instead of f-strings? In my opinion f-strings are better to read in code.

Is there a reason to use the string literal instead of f-strings? In my opinion f-strings are better to read in code.
Review

https://blog.pilosus.org/posts/2020/01/24/python-f-strings-in-logging/ - it is recommended (and if I remember correctly some of the python validators complain on those) to use regular % formatting instead of fstrings explicitly in logging

https://blog.pilosus.org/posts/2020/01/24/python-f-strings-in-logging/ - it is recommended (and if I remember correctly some of the python validators complain on those) to use regular % formatting instead of fstrings explicitly in logging
if not doc.get("type"):
logging.debug("Skipping unsupported type")
continue
if doc["type"] == "dev":
doc_type = "dev-guide"
@ -158,7 +159,11 @@ def process_repositories(args, service):
doc_type = doc["type"]
template_name = f"{doc_type}{job_suffix}"
if doc_type in ["api-ref", "umn", "dev-guide"]:
logging.debug(
"Ensuring required zuul template %s is present" % template_name)
if template_name not in zuul_templates:
logging.debug("Adding template %s" % template_name)
zuul_config_updated = True
zuul_templates.append(template_name)
else:
job_name = f"build-otc-{doc['service_type']}-{doc_type}"
@ -245,6 +250,8 @@ def process_repositories(args, service):
head=branch_name,
),
)
else:
logging.info("No update is necessary")
def main():