You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2020/04/04 20:45:22 UTC

[libcloud] 20/21: Add new "ssh_key_password" argument to the deploy_node() method.

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 14125f5ac0948da80ac055c170c286471b6cb098
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Tue Mar 31 23:31:18 2020 +0200

    Add new "ssh_key_password" argument to the deploy_node() method.
    
    Update ParamikoSSHClient to utilize existing password argument, as per
    base API.
---
 libcloud/compute/base.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 4b2636c..9e933a0 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -991,6 +991,7 @@ class NodeDriver(BaseDriver):
                     ssh_port=22,  # type: int
                     ssh_timeout=10,  # type: int
                     ssh_key=None,  # type: Optional[T_Ssh_key]
+                    ssh_key_password=None,  # type: Optional[str]
                     auth=None,  # type: T_Auth
                     timeout=SSH_CONNECT_TIMEOUT,  # type: int
                     max_tries=3,  # type: int
@@ -1070,6 +1071,9 @@ class NodeDriver(BaseDriver):
                              to attempt to authenticate. (optional)
         :type ssh_key: ``str`` or ``list`` of ``str``
 
+        :param ssh_key_password: Optional password used for encrypted keys.
+        :type ssh_key_password: ``str``
+
         :param timeout: How many seconds to wait before timing out.
                              (default is 600)
         :type timeout: ``int``
@@ -1172,7 +1176,8 @@ class NodeDriver(BaseDriver):
                     task=deploy, node=node,
                     ssh_hostname=ip_addresses[0], ssh_port=ssh_port,
                     ssh_username=username, ssh_password=password,
-                    ssh_key_file=ssh_key, ssh_timeout=ssh_timeout,
+                    ssh_key_file=ssh_key, ssh_key_password=ssh_key_password,
+                    ssh_timeout=ssh_timeout,
                     timeout=deploy_timeout, max_tries=max_tries)
             except Exception as e:
                 # Try alternate username
@@ -1770,7 +1775,8 @@ class NodeDriver(BaseDriver):
         ssh_port,  # type: int
         ssh_username,  # type: str
         ssh_password,  # type: Optional[str]
-        ssh_key_file,  # type:Optional[T_Ssh_key]
+        ssh_key_file,  # type: Optional[T_Ssh_key]
+        ssh_key_password,  # type: Optional[str]
         ssh_timeout,  # type: int
         timeout,  # type: int
         max_tries  # type: int
@@ -1784,7 +1790,7 @@ class NodeDriver(BaseDriver):
         """
         ssh_client = SSHClient(hostname=ssh_hostname,
                                port=ssh_port, username=ssh_username,
-                               password=ssh_password,
+                               password=ssh_key_password or ssh_password,
                                key_files=ssh_key_file,
                                timeout=ssh_timeout)