diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2016-06-08 16:06:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-06-08 16:06:16 +0000 |
commit | 2e486afde01d036509fe01421855e22038fcea4a (patch) | |
tree | 5a5f6a3bf45a7a4ab93c971e92afc86742b14108 /testcases/security_scan | |
parent | 03fc68820d1badd600832de3b7c6dd72368dd198 (diff) | |
parent | d8ca1bcf28298d50493a8cb2c7fbd2c57e9f7987 (diff) |
Merge "Fixes incorrect parenthesis format & adds ft_logger import"
Diffstat (limited to 'testcases/security_scan')
-rw-r--r-- | testcases/security_scan/connect.py | 48 | ||||
-rw-r--r-- | testcases/security_scan/security_scan.py | 2 |
2 files changed, 27 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() diff --git a/testcases/security_scan/security_scan.py b/testcases/security_scan/security_scan.py index f7f02cd9c..25b5b292d 100644 --- a/testcases/security_scan/security_scan.py +++ b/testcases/security_scan/security_scan.py @@ -22,6 +22,8 @@ from keystoneclient.auth.identity import v2 from keystoneclient import session from novaclient import client +import functest.utils.functest_logger as ft_logger + __version__ = 0.1 __author__ = 'Luke Hinds (lhinds@redhat.com)' __url__ = 'https://wiki.opnfv.org/display/functest/Functest+Security' |