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 2011/10/20 01:25:10 UTC

svn commit: r1186566 - /libcloud/trunk/libcloud/compute/ssh.py

Author: tomaz
Date: Wed Oct 19 23:25:10 2011
New Revision: 1186566

URL: http://svn.apache.org/viewvc?rev=1186566&view=rev
Log:
Modify ParamikoSSHClient.connect so it supports authentication using a key file.
This patch has been submitted by Jay Doane <issues dot apache dot org at jay dot
m82 dot com> and it's part of LIBCLOUD-116.

Modified:
    libcloud/trunk/libcloud/compute/ssh.py

Modified: libcloud/trunk/libcloud/compute/ssh.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/ssh.py?rev=1186566&r1=1186565&r2=1186566&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/ssh.py (original)
+++ libcloud/trunk/libcloud/compute/ssh.py Wed Oct 19 23:25:10 2011
@@ -129,10 +129,16 @@ class ParamikoSSHClient(BaseSSHClient):
         conninfo = {'hostname': self.hostname,
                     'port': self.port,
                     'username': self.username,
-                    'password': self.password,
                     'allow_agent': False,
                     'look_for_keys': False}
 
+        if self.password:
+            conninfo['password'] = self.password
+        elif self.key:
+            conninfo['key_filename'] = self.key
+        else:
+            raise Exception('must specify either password or key_filename')
+
         if self.timeout:
             conninfo['timeout'] = self.timeout