potiuk commented on a change in pull request #6586: [AIRFLOW-5936] Allow 
explicit get_pty in SSHOperator
URL: https://github.com/apache/airflow/pull/6586#discussion_r347082081
 
 

 ##########
 File path: airflow/contrib/operators/ssh_operator.py
 ##########
 @@ -96,15 +101,14 @@ def execute(self, context):
 
             with self.ssh_hook.get_conn() as ssh_client:
                 # Auto apply tty when its required in case of sudo
-                get_pty = False
                 if self.command.startswith('sudo'):
-                    get_pty = True
+                    self.get_pty = True
 
 Review comment:
   I think it might make sense to move this to constructor. command is set only 
in the constructor so we can keep all the pty logic there and it could be 
one-liner 
   `self.get_pty = self.start_command.starstwith('sudo') or self.get_pty`

----------------------------------------------------------------
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