summaryrefslogtreecommitdiffstats
path: root/testcases/security_scan/connect.py
diff options
context:
space:
mode:
Diffstat (limited to 'testcases/security_scan/connect.py')
-rw-r--r--testcases/security_scan/connect.py48
1 files changed, 25 insertions, 23 deletions
diff --git a/testcases/security_scan/connect.py b/testcases/security_scan/connect.py
index 1c4e209ad..e040de16f 100644
--- a/testcases/security_scan/connect.py
+++ b/testcases/security_scan/connect.py
@@ -24,6 +24,8 @@ logger = ft_logger.Logger("security_scan").getLogger()
paramiko.util.log_to_file("/var/log/paramiko.log")
+paramiko.util.log_to_file("/var/log/paramiko.log")
+
class novaManager:
def __init__(self, *args):
@@ -37,13 +39,13 @@ class novaManager:
client.connect(INSTALLER_IP, port=22, username='stack')
except paramiko.SSHException:
logger.error("Password is invalid for "
- "undercloud host: {0}").format(INSTALLER_IP)
+ "undercloud host: {0}".format(INSTALLER_IP))
except paramiko.AuthenticationException:
logger.error("Authentication failed for "
- "undercloud host: {0}").format(INSTALLER_IP)
+ "undercloud host: {0}".format(INSTALLER_IP))
except socket.error:
logger.error("Socker Connection failed for "
- "undercloud host: {0}").format(INSTALLER_IP)
+ "undercloud host: {0}".format(INSTALLER_IP))
stdin, stdout, stderr = client.exec_command(com)
return stdout.read()
@@ -68,13 +70,13 @@ class connectionManager:
client.connect(INSTALLER_IP, port=22, username='stack')
except paramiko.SSHException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except paramiko.AuthenticationException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except socket.error:
logger.error("Socker Connection failed for "
- "undercloud host: {0}").format(self.host)
+ "undercloud host: {0}".format(self.host))
transport = client.get_transport()
local_addr = ('127.0.0.1', 0)
@@ -91,13 +93,13 @@ class connectionManager:
sftp.put(localpath, remotepath)
except paramiko.SSHException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except paramiko.AuthenticationException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except socket.error:
logger.error("Socker Connection failed for "
- "undercloud host: {0}").format(self.host)
+ "undercloud host: {0}".format(self.host))
output = ""
stdin, stdout, stderr = remote_client.exec_command(com)
@@ -122,13 +124,13 @@ class connectionManager:
client.connect(INSTALLER_IP, port=22, username='stack')
except paramiko.SSHException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except paramiko.AuthenticationException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except socket.error:
logger.error("Socker Connection failed for "
- "undercloud host: {0}").format(self.host)
+ "undercloud host: {0}".format(self.host))
transport = client.get_transport()
local_addr = ('127.0.0.1', 0) # 0 denotes choose random port
@@ -143,13 +145,13 @@ class connectionManager:
key_filename=self.user_key, sock=channel)
except paramiko.SSHException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except paramiko.AuthenticationException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except socket.error:
logger.error("Socker Connection failed for "
- "undercloud host: {0}").format(self.host)
+ "undercloud host: {0}".format(self.host))
chan = remote_client.get_transport().open_session()
chan.get_pty()
@@ -172,13 +174,13 @@ class connectionManager:
client.connect(INSTALLER_IP, port=22, username='stack')
except paramiko.SSHException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except paramiko.AuthenticationException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except socket.error:
logger.error("Socker Connection failed for "
- "undercloud host: {0}").format(self.host)
+ "undercloud host: {0}".format(self.host))
transport = client.get_transport()
local_addr = ('127.0.0.1', 0) # 0 denotes choose random port
@@ -193,18 +195,18 @@ class connectionManager:
key_filename=self.user_key, sock=channel)
except paramiko.SSHException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except paramiko.AuthenticationException:
logger.error("Authentication failed for "
- "host: {0}").format(self.host)
+ "host: {0}".format(self.host))
except socket.error:
logger.error("Socker Connection failed for "
- "undercloud host: {0}").format(self.host)
+ "undercloud host: {0}".format(self.host))
# Download the reports
sftp = remote_client.open_sftp()
- logger.info('Downloading \"{0}\"...\n').format(reportname)
+ logger.info("Downloading \"{0}\"...\n".format(reportname))
sftp.get(reportfile, ('{0}/{1}'.format(dl_folder, reportname)))
- logger.info('Downloading \"{0}\"...\n').format(resultsname)
+ logger.info("Downloading \"{0}\"...\n".format(resultsname))
sftp.get(reportfile, ('{0}/{1}'.format(dl_folder, resultsname)))
sftp.close()
transport.close()