Skip to content

Commit f17b383

Browse files
committed
Fix logger in usage in entrypoints
2 scripts were using a default logger instead of the one that is used by other scripts and pre-configured. This caused missing logs in these scripts. JIRA: ISV-1682
1 parent b96ae98 commit f17b383

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

operator-pipeline-images/operatorcert/entrypoints/bundle_dockerfile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from operatorcert.logger import setup_logger
88
from operatorcert.utils import store_results
99

10+
LOGGER = logging.getLogger("operator-cert")
11+
1012

1113
class AnnotationFileNotFound(Exception):
1214
"""
@@ -45,7 +47,7 @@ def generate_dockerfile_content(args: Any) -> str:
4547
Returns:
4648
str: Content of generated Dockerfile
4749
"""
48-
logging.debug("Generating a dockerfile...")
50+
LOGGER.debug("Generating a dockerfile...")
4951
dockerfile_content = "FROM scratch\n\n"
5052

5153
bundle_path = pathlib.Path(args.bundle_path)

operator-pipeline-images/operatorcert/entrypoints/pipelinerun_summary.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ def main() -> None:
3131
setup_logger(level=log_level, log_format="%(message)s")
3232
pr = PipelineRun.from_files(args.pr_path, args.trs_path)
3333

34-
logging.info(pr.markdown_summary(include_final_tasks=args.include_final_tasks))
34+
LOGGER.info(pr.markdown_summary(include_final_tasks=args.include_final_tasks))
35+
36+
37+
if __name__ == "__main__": # pragma: no cover
38+
main()

operator-pipeline-images/operatorcert/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def store_results(results: Dict[str, str]):
4343
for result_name, result_value in results.items():
4444
if result_value is None:
4545
result_value = ""
46-
logging.error(f"Result {result_name} is empty")
47-
logging.debug(f"Storing {result_name}")
46+
LOGGER.error(f"Result {result_name} is empty")
47+
LOGGER.debug(f"Storing {result_name}")
4848
with open(result_name, "w") as result_file:
4949
if type(result_value) is dict:
5050
json.dump(result_value, result_file)

0 commit comments

Comments
 (0)