Skip to content

Commit 0b3e4a2

Browse files
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 <[email protected]>
1 parent 79a193b commit 0b3e4a2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cephadm/build.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,16 @@ def _ignore_cephadmlib(
301301
def _compile(dest, tempdir):
302302
"""Compile the zipapp."""
303303
log.info("Byte-compiling py to pyc")
304-
compileall.compile_dir(
304+
ok = compileall.compile_dir(
305305
tempdir,
306306
maxlevels=16,
307307
legacy=True,
308308
quiet=1,
309309
workers=0,
310310
)
311+
if not ok:
312+
log.error("compileall.compile_dir failed (see output for details)")
313+
raise ValueError("byte-compile failed")
311314
# TODO we could explicitly pass a python version here
312315
log.info("Constructing the zipapp file")
313316
try:

0 commit comments

Comments
 (0)