diff options
author | 2017-02-14 14:37:05 +0100 | |
---|---|---|
committer | 2017-02-14 16:58:05 +0100 | |
commit | e73000209d46461b1196f560bf5c36bade020134 (patch) | |
tree | 6a09e8a127d777815378ef833824f924df82875c /modules | |
parent | e5f30e9839c4e36d7712b0e7dd3c319a85048322 (diff) |
Fix flake8 violations in releng
Change-Id: I45769ff9c9db2de9fbba69117a92de414dd7f651
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/opnfv/deployment/example.py | 2 | ||||
-rw-r--r-- | modules/opnfv/deployment/manager.py | 2 | ||||
-rw-r--r-- | modules/opnfv/utils/Credentials.py | 2 | ||||
-rw-r--r-- | modules/opnfv/utils/constants.py | 1 | ||||
-rw-r--r-- | modules/opnfv/utils/ovs_logger.py | 9 | ||||
-rw-r--r-- | modules/opnfv/utils/ssh_utils.py | 8 |
6 files changed, 13 insertions, 11 deletions
diff --git a/modules/opnfv/deployment/example.py b/modules/opnfv/deployment/example.py index 6a76eb9c3..f45683260 100644 --- a/modules/opnfv/deployment/example.py +++ b/modules/opnfv/deployment/example.py @@ -18,4 +18,4 @@ for node in nodes: print("Hello, I am node '%s' and my ip is %s." % (node.run_cmd('hostname'), node.ip)) -print handler.get_deployment_info() +print(handler.get_deployment_info()) diff --git a/modules/opnfv/deployment/manager.py b/modules/opnfv/deployment/manager.py index f0e442903..9f77ff0a7 100644 --- a/modules/opnfv/deployment/manager.py +++ b/modules/opnfv/deployment/manager.py @@ -56,7 +56,7 @@ class Deployment(object): version = self.deployment_info['openstack_version'].split('.')[0] name = os_versions[version] return name - except Exception as e: + except Exception: return 'Unknown release' def get_dict(self): diff --git a/modules/opnfv/utils/Credentials.py b/modules/opnfv/utils/Credentials.py index 6441b841c..141ecbd93 100644 --- a/modules/opnfv/utils/Credentials.py +++ b/modules/opnfv/utils/Credentials.py @@ -77,7 +77,7 @@ class Credentials(object): creds_file = '/root/openrc' try: self.handler.get_file_from_controller(creds_file, target_path) - except Exception, e: + except Exception as e: self.logger.error( "Cannot get %s from controller. %e" % (creds_file, e)) pass diff --git a/modules/opnfv/utils/constants.py b/modules/opnfv/utils/constants.py index ed83488d4..56008c37f 100644 --- a/modules/opnfv/utils/constants.py +++ b/modules/opnfv/utils/constants.py @@ -14,6 +14,7 @@ EXIT_OK = 0 EXIT_RUN_ERROR = -1 EXIT_PUSH_TO_TEST_DB_ERROR = -2 + class Constants(object): INSTALLERS = ['apex', 'fuel', 'compass', 'joid', "daisy"] VERSIONS = ['arno', 'brahmaputra', 'colorado', 'danube'] diff --git a/modules/opnfv/utils/ovs_logger.py b/modules/opnfv/utils/ovs_logger.py index 3159609f1..75b4cec80 100644 --- a/modules/opnfv/utils/ovs_logger.py +++ b/modules/opnfv/utils/ovs_logger.py @@ -16,6 +16,7 @@ logger = OPNFVLogger.Logger('ovs_logger').getLogger() class OVSLogger(object): + def __init__(self, basedir, ft_resdir): self.ovs_dir = basedir self.ft_resdir = ft_resdir @@ -32,7 +33,7 @@ class OVSLogger(object): hosts = stdout.readline().strip().split(' ') found_host = [h for h in hosts if h.startswith(host_prefix)][0] return found_host - except Exception, e: + except Exception as e: logger.error(e) def __dump_to_file(self, operation, host, text, timestamp=None): @@ -55,7 +56,7 @@ class OVSLogger(object): .format(cmd, host)) output = ''.join(stdout.readlines()) return output - except Exception, e: + except Exception as e: logger.error('[__remote_command(ssh_client, {0})]: {1}' .format(cmd, e)) return None @@ -78,7 +79,7 @@ class OVSLogger(object): host = self.__ssh_host(ssh_conn) self.__dump_to_file(operation, host, output, timestamp=timestamp) return output - except Exception, e: + except Exception as e: logger.error('[ofctl_dump_flows(ssh_client, {0}, {1})]: {2}' .format(br, choose_table, e)) return None @@ -91,7 +92,7 @@ class OVSLogger(object): host = self.__ssh_host(ssh_conn) self.__dump_to_file(operation, host, output, timestamp=timestamp) return output - except Exception, e: + except Exception as e: logger.error('[vsctl_show(ssh_client)]: {0}'.format(e)) return None diff --git a/modules/opnfv/utils/ssh_utils.py b/modules/opnfv/utils/ssh_utils.py index f90045540..d17f5ae81 100644 --- a/modules/opnfv/utils/ssh_utils.py +++ b/modules/opnfv/utils/ssh_utils.py @@ -47,7 +47,7 @@ def get_ssh_client(hostname, password=password) return client - except Exception, e: + except Exception as e: logger.error(e) return None @@ -57,7 +57,7 @@ def get_file(ssh_conn, src, dest): sftp = ssh_conn.open_sftp() sftp.get(src, dest) return True - except Exception, e: + except Exception as e: logger.error("Error [get_file(ssh_conn, '%s', '%s']: %s" % (src, dest, e)) return None @@ -68,7 +68,7 @@ def put_file(ssh_conn, src, dest): sftp = ssh_conn.open_sftp() sftp.put(src, dest) return True - except Exception, e: + except Exception as e: logger.error("Error [put_file(ssh_conn, '%s', '%s']: %s" % (src, dest, e)) return None @@ -128,5 +128,5 @@ class ProxyHopClient(paramiko.SSHClient): pkey=proxy_key, sock=self.proxy_channel) os.remove(self.local_ssh_key) - except Exception, e: + except Exception as e: logger.error(e) |