youngyjd commented on a change in pull request #4916: [AIRFLOW-4087] Don't use 
sudo to remove tmp config when no run_as_user
URL: https://github.com/apache/airflow/pull/4916#discussion_r265779889
 
 

 ##########
 File path: airflow/task/task_runner/base_task_runner.py
 ##########
 @@ -161,4 +161,4 @@ def on_finish(self):
         A callback that should be called when this is done running.
         """
         if self._cfg_path and os.path.isfile(self._cfg_path):
-            subprocess.call(['sudo', 'rm', self._cfg_path], close_fds=True)
+            subprocess.call(['rm', self._cfg_path], close_fds=True)
 
 Review comment:
   @ashb this makes sense to me after knowing more about `run_as_user`. You 
mean if the `airflow worker` command is run by `root` and the `run_as_user` at 
the same time needs to have sudo privilege to call `sudo rm /tmp/...` to remove 
the temp cfg file owned by root, right?
   
   btw, I think you missed `sudo` in `subprocess.call(['rm', self._cfg_path], 
close_fds=True)` of your suggestion, right?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to