You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/12/07 22:02:07 UTC

[GitHub] [airflow] plockaby commented on a change in pull request #20114: fixing #19028 by moving chown to use sudo

plockaby commented on a change in pull request #20114:
URL: https://github.com/apache/airflow/pull/20114#discussion_r764395347



##########
File path: airflow/task/task_runner/base_task_runner.py
##########
@@ -87,11 +86,7 @@ def __init__(self, local_task_job):
 
         self._error_file = NamedTemporaryFile(delete=True)
         if self.run_as_user:
-            try:
-                os.chown(self._error_file.name, getpwnam(self.run_as_user).pw_uid, -1)
-            except KeyError:
-                # No user `run_as_user` found
-                pass
+            subprocess.call(['sudo', 'chown', self.run_as_user, self._error_file.name], close_fds=True)

Review comment:
       I agree that you're probably right it should be `check_call`. I simply stole the the subprocess call that runs a chown a few statements above so maybe they should both change?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org