From bb5f2db75b9fc09604ec03fc7eabd0f68f003bd5 Mon Sep 17 00:00:00 2001 From: cris-b Date: Tue, 23 Feb 2021 10:50:55 +0000 Subject: [PATCH] Fix permission error on non-POSIX filesystem (#13121) * Fix https://github.com/apache/airflow/issues/12669 - failure to change ownership of log file on azure --- airflow/utils/log/file_task_handler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/airflow/utils/log/file_task_handler.py b/airflow/utils/log/file_task_handler.py index 16849d1dbf251..ef359110125c4 100644 --- a/airflow/utils/log/file_task_handler.py +++ b/airflow/utils/log/file_task_handler.py @@ -244,6 +244,9 @@ def _init_file(self, ti): if not os.path.exists(full_path): open(full_path, "a").close() # TODO: Investigate using 444 instead of 666. - os.chmod(full_path, 0o666) + try: + os.chmod(full_path, 0o666) + except OSError: + logging.warning("OSError while change ownership of the log file") return full_path