XD-DENG commented on a change in pull request #11097:
URL: https://github.com/apache/airflow/pull/11097#discussion_r493240369



##########
File path: airflow/providers/ssh/hooks/ssh.py
##########
@@ -106,8 +106,11 @@ def __init__(
                     self.key_file = extra_options.get("key_file")
 
                 private_key = extra_options.get('private_key')
-                if private_key:
+                private_key_passphrase = 
extra_options.get('private_key_passphrase')
+                if private_key and not private_key_passphrase:
                     self.pkey = 
paramiko.RSAKey.from_private_key(StringIO(private_key))
+                elif private_key and private_key_passphrase:
+                    self.pkey = 
paramiko.RSAKey.from_private_key(StringIO(private_key),password=private_key_passphrase)

Review comment:
       Style issue: there should be a space before "password=...", I believe

##########
File path: airflow/providers/ssh/hooks/ssh.py
##########
@@ -106,8 +106,11 @@ def __init__(
                     self.key_file = extra_options.get("key_file")
 
                 private_key = extra_options.get('private_key')
-                if private_key:
+                private_key_passphrase = 
extra_options.get('private_key_passphrase')

Review comment:
       Very minor thing (not a must-change): maybe code like below would be 
more straight forward from reading aspect?
   
   ```
   if private_key:
       if private_key_passphrase:
           ...
       else:
           ...
   ```




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


Reply via email to