From dc4df38e7fe002dc1a02945f6c0e410c656c4457 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Wed, 28 Feb 2024 07:13:06 +0100 Subject: [PATCH] Better fix ownership behaviour for Breeze (#37760) Fix ownership with docker is fixing the whole airflow directory now and is less verbose when nothing happens. --- dev/breeze/src/airflow_breeze/utils/docker_command_utils.py | 4 +--- scripts/in_container/run_fix_ownership.py | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py b/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py index 0d466c0d62299..e4e19a8cd1514 100644 --- a/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py +++ b/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py @@ -557,7 +557,7 @@ def fix_ownership_using_docker(quiet: bool = False): "docker", "run", "-v", - "./scripts/in_container:/opt/airflow/scripts/in_container", + f"{AIRFLOW_SOURCES_ROOT}:/opt/airflow/", "-e", f"HOST_OS={get_host_os()}", "-e", @@ -566,8 +566,6 @@ def fix_ownership_using_docker(quiet: bool = False): f"HOST_GROUP_ID={get_host_group_id()}", "-e", f"DOCKER_IS_ROOTLESS={is_docker_rootless()}", - "-e", - f"VERBOSE_COMMANDS={str(not quiet).lower()}", "--rm", "-t", OWNERSHIP_CLEANUP_DOCKER_TAG, diff --git a/scripts/in_container/run_fix_ownership.py b/scripts/in_container/run_fix_ownership.py index d2b7809988d51..cd9530cbc547b 100755 --- a/scripts/in_container/run_fix_ownership.py +++ b/scripts/in_container/run_fix_ownership.py @@ -44,7 +44,6 @@ def change_ownership_of_files(path: Path) -> None: sys.exit(1) count_files = 0 root_uid = pwd.getpwnam("root").pw_uid - print("Attempting to see if there are files that need to be changed to host user ownership") for file in path.rglob("*"): try: if file.is_symlink() and file.lstat().st_uid == root_uid: @@ -66,8 +65,6 @@ def change_ownership_of_files(path: Path) -> None: print(f"Could not change ownership of {file}") if count_files: print(f"Changed ownership of {count_files} files back to {host_user_id}:{host_group_id}.") - else: - print("No files needed to change ownership") if __name__ == "__main__":