Skip to content

Commit

Permalink
Better fix ownership behaviour for Breeze (apache#37760)
Browse files Browse the repository at this point in the history
Fix ownership with docker is fixing the whole airflow directory
now and is less verbose when nothing happens.
  • Loading branch information
potiuk authored Feb 28, 2024
1 parent 0517204 commit dc4df38
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
4 changes: 1 addition & 3 deletions dev/breeze/src/airflow_breeze/utils/docker_command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions scripts/in_container/run_fix_ownership.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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__":
Expand Down

0 comments on commit dc4df38

Please sign in to comment.