From: John Mulligan Date: Wed, 3 Sep 2025 17:47:04 +0000 (-0400) Subject: cephadm: fail the script if byte-compile step fails X-Git-Tag: v21.0.0~157^2~157^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0b3e4a244a34e08e3fc7a7158ee82248bce05be8;p=ceph.git cephadm: fail the script if byte-compile step fails Instead of raising an exception on a failure the compileall.compile_dir returns a boolean indicating if all files compiled successfully or not. Fail the build.py script if byte compiling fails as that usually indicates some sort of syntax error. Fixes: https://tracker.ceph.com/issues/72850 Signed-off-by: John Mulligan --- diff --git a/src/cephadm/build.py b/src/cephadm/build.py index 01c91fc16803..d86737dfd2a3 100755 --- a/src/cephadm/build.py +++ b/src/cephadm/build.py @@ -301,13 +301,16 @@ def _ignore_cephadmlib( def _compile(dest, tempdir): """Compile the zipapp.""" log.info("Byte-compiling py to pyc") - compileall.compile_dir( + ok = compileall.compile_dir( tempdir, maxlevels=16, legacy=True, quiet=1, workers=0, ) + if not ok: + log.error("compileall.compile_dir failed (see output for details)") + raise ValueError("byte-compile failed") # TODO we could explicitly pass a python version here log.info("Constructing the zipapp file") try: