From c82f3d9b77af1e7577dbe753438c81ea62047ee9 Mon Sep 17 00:00:00 2001 From: ToniAdreal <184365500+ToniAdreal@users.noreply.github.com> Date: Sun, 22 Nov 2026 03:02:17 +0000 Subject: [PATCH] Make get_working_dir reuse the working directory in docker-to-squash.py get_working_dir returned a different directory on every call: the requested directory the first time, a docker-to-squash subdirectory of it the second time, and on the third call os.makedirs raised FileExistsError, wrapped as 'Could not create working_dir'. pull-build calls it once per image, so the third image always failed, and push-update could not find the artifacts pull-build wrote. Create the directory with exist_ok=True and always return it. No caller depends on the subdirectory shape; all of them join paths under the returned directory. Signed-off-by: ToniAdreal <184365500+ToniAdreal@users.noreply.github.com> --- bin/docker-to-squash.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/bin/docker-to-squash.py b/bin/docker-to-squash.py index 4ea3a371f6b..7bb58a4be7c 100755 --- a/bin/docker-to-squash.py +++ b/bin/docker-to-squash.py @@ -237,16 +237,11 @@ def hdfs_stat(file_path, fmt, print_stdout=False, print_stderr=True, raise_on_er def get_working_dir(directory): - working_dir = "(undefined)" try: - if os.path.isdir(directory): - working_dir = os.path.join(directory, "docker-to-squash") - else: - working_dir = directory - os.makedirs(working_dir) + os.makedirs(directory, exist_ok=True) except Exception as ex: - raise Exception(f"Could not create working_dir: {working_dir}, {ex}") - return working_dir + raise Exception(f"Could not create working_dir: {directory}, {ex}") + return directory def is_sha256_hash(string):