Revert "CLOUDSTACK-7408: Fixed - Private key of the ssh keypair was getting 
corrupted"

This reverts commit e921ec6ec79c50096d58264d60c15091969ff888.

CLOUDSTACK-7408: sshClient.py - removing function load_host_keys(). This 
function is used to load host keys from local host keys file and to save back 
the host key. It is not needed while running test cases because we are 
connecting to unknown host anyway and don't want to use any local host key 
file. We have the AutoAddPolicy for missing host key file, hence whenever ssh 
connects to a new host, it will save the host key in memory temporarily.

Signed-off-by: SrikanteswaraRao Talluri <tall...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e87da186
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e87da186
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e87da186

Branch: refs/heads/master
Commit: e87da186f3b094e76a174713d6933f83d1c00854
Parents: 591f468
Author: Gaurrav Aradhye <gaurav.arad...@clogeny.com>
Authored: Thu Oct 30 12:23:49 2014 +0530
Committer: SrikanteswaraRao Talluri <tall...@apache.org>
Committed: Thu Oct 30 14:51:54 2014 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/lib/base.py  |  8 +++-----
 tools/marvin/marvin/lib/utils.py |  7 ++-----
 tools/marvin/marvin/sshClient.py | 17 +----------------
 3 files changed, 6 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e87da186/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 77faeeb..7f53328 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -552,7 +552,7 @@ class VirtualMachine:
 
     def get_ssh_client(
             self, ipaddress=None, reconnect=False, port=None,
-            keyPairFileLocation=None, knownHostsFilePath=None):
+            keyPairFileLocation=None):
         """Get SSH object of VM"""
 
         # If NAT Rules are not created while VM deployment in Advanced mode
@@ -571,16 +571,14 @@ class VirtualMachine:
                 self.ssh_port,
                 self.username,
                 self.password,
-                keyPairFileLocation=keyPairFileLocation,
-                knownHostsFilePath=knownHostsFilePath
+                keyPairFileLocation=keyPairFileLocation
             )
         self.ssh_client = self.ssh_client or is_server_ssh_ready(
             self.ssh_ip,
             self.ssh_port,
             self.username,
             self.password,
-            keyPairFileLocation=keyPairFileLocation,
-            knownHostsFilePath=knownHostsFilePath
+            keyPairFileLocation=keyPairFileLocation
         )
         return self.ssh_client
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e87da186/tools/marvin/marvin/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/utils.py b/tools/marvin/marvin/lib/utils.py
index b58b59d..8788b3b 100644
--- a/tools/marvin/marvin/lib/utils.py
+++ b/tools/marvin/marvin/lib/utils.py
@@ -121,9 +121,7 @@ def cleanup_resources(api_client, resources):
         obj.delete(api_client)
 
 
-def is_server_ssh_ready(ipaddress, port, username, password, retries=20,
-        retryinterv=30, timeout=10.0, keyPairFileLocation=None,
-        knownHostsFilePath=None):
+def is_server_ssh_ready(ipaddress, port, username, password, retries=20, 
retryinterv=30, timeout=10.0, keyPairFileLocation=None):
     '''
     @Name: is_server_ssh_ready
     @Input: timeout: tcp connection timeout flag,
@@ -142,8 +140,7 @@ def is_server_ssh_ready(ipaddress, port, username, 
password, retries=20,
             keyPairFiles=keyPairFileLocation,
             retries=retries,
             delay=retryinterv,
-            timeout=timeout,
-            knownHostsFilePath=knownHostsFilePath)
+            timeout=timeout)
     except Exception, e:
         raise Exception("SSH connection has Failed. Waited %ss. Error is %s" % 
(retries * retryinterv, str(e)))
     else:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e87da186/tools/marvin/marvin/sshClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sshClient.py b/tools/marvin/marvin/sshClient.py
index f027890..e481109 100644
--- a/tools/marvin/marvin/sshClient.py
+++ b/tools/marvin/marvin/sshClient.py
@@ -24,7 +24,6 @@ from paramiko import (BadHostKeyException,
                       SFTPClient)
 import socket
 import time
-import os
 from marvin.cloudstackException import (
     internalError,
     GetDetailExceptionInfo
@@ -50,8 +49,7 @@ class SshClient(object):
     '''
 
     def __init__(self, host, port, user, passwd, retries=60, delay=10,
-                 log_lvl=logging.DEBUG, keyPairFiles=None, timeout=10.0,
-                 knownHostsFilePath=None):
+                 log_lvl=logging.DEBUG, keyPairFiles=None, timeout=10.0):
         self.host = None
         self.port = 22
         self.user = user
@@ -79,18 +77,6 @@ class SshClient(object):
             self.timeout = timeout
         if port is not None and port >= 0:
             self.port = port
-
-        # If the known_hosts file is not at default location,
-        # then its location can be passed, or else the default
-        # path will be considered (which is ~/.ssh/known_hosts)
-        if knownHostsFilePath:
-            self.knownHostsFilePath = knownHostsFilePath
-        else:
-            self.knownHostsFilePath = os.path.expanduser(
-                os.path.join(
-                    "~",
-                    ".ssh",
-                    "known_hosts"))
         if self.createConnection() == FAILED:
             raise internalError("SSH Connection Failed")
 
@@ -134,7 +120,6 @@ class SshClient(object):
                                      password=self.passwd,
                                      timeout=self.timeout)
                 else:
-                    self.ssh.load_host_keys(self.knownHostsFilePath)
                     self.ssh.connect(hostname=self.host,
                                      port=self.port,
                                      username=self.user,

Reply via email to