This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch 2.8.x
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit a371c828601d4fbbbb6310ded5cf4138df68e871
Author: Tomaz Muraus <[email protected]>
AuthorDate: Tue Mar 31 15:15:17 2020 +0200

    Update Paramiko SSH client to throw if a private key is password protect
    and no password is provided.
    
    Also update "deploy_node" to correctly propagate fatal exception
    (invalid key format, key is password protected) instead of trying to
    retry on such exceptions.
---
 libcloud/compute/base.py | 2 ++
 libcloud/compute/ssh.py  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 59c4db7..4529844 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -1732,6 +1732,8 @@ class NodeDriver(BaseDriver):
                     'no such file or directory',
                     'invalid key',
                     'not a valid ',
+                    'invalid or unsupported key type',
+                    'private key file is encrypted'
                 ]
 
                 # Propagate (key) file doesn't exist errors
diff --git a/libcloud/compute/ssh.py b/libcloud/compute/ssh.py
index 481c11e..78718fe 100644
--- a/libcloud/compute/ssh.py
+++ b/libcloud/compute/ssh.py
@@ -538,6 +538,8 @@ class ParamikoSSHClient(BaseSSHClient):
 
             try:
                 key = cls.from_private_key(StringIO(key_value), passpharse)
+            except paramiko.ssh_exception.PasswordRequiredException as e:
+                raise e
             except (paramiko.ssh_exception.SSHException, AssertionError):
                 # Invalid key, try other key type
                 pass

Reply via email to