Merge "Use flake8-import-order plugin and clean up exceptions"
This commit is contained in:
commit
c1b9a1afaf
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import gettext
|
||||
|
||||
import six
|
||||
|
||||
|
||||
|
@ -12,8 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from alembic import context
|
||||
from logging import config as logging_config
|
||||
|
||||
from alembic import context
|
||||
from neutron_lib.db import model_base
|
||||
from oslo_config import cfg
|
||||
from oslo_db.sqlalchemy import session
|
||||
|
@ -12,9 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
import socket
|
||||
|
||||
import netaddr
|
||||
from neutron.db import l3_db
|
||||
from neutron.db import models_v2
|
||||
from neutron_lib.api import validators
|
||||
|
@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
import requests
|
||||
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.plugins.common import utils as plugin_utils
|
||||
@ -25,6 +24,7 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_service import loopingcall
|
||||
import requests
|
||||
|
||||
from neutron_vpnaas._i18n import _
|
||||
from neutron_vpnaas.services.vpn.common import topics
|
||||
|
@ -18,7 +18,6 @@ import filecmp
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import six
|
||||
import socket
|
||||
|
||||
import eventlet
|
||||
@ -39,6 +38,7 @@ from oslo_log import helpers as log_helpers
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from oslo_service import loopingcall
|
||||
import six
|
||||
|
||||
from neutron_vpnaas._i18n import _
|
||||
from neutron_vpnaas.extensions import vpnaas
|
||||
|
@ -13,11 +13,10 @@
|
||||
import collections
|
||||
import copy
|
||||
import functools
|
||||
import os
|
||||
|
||||
import mock
|
||||
import netaddr
|
||||
import os
|
||||
import testtools
|
||||
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.l3 import namespaces as n_namespaces
|
||||
from neutron.agent.l3 import router_info
|
||||
@ -38,6 +37,7 @@ from neutron_lib.utils import net as n_utils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
import testtools
|
||||
|
||||
from neutron_vpnaas.services.vpn import agent as vpn_agent
|
||||
from neutron_vpnaas.services.vpn.agent import vpn_agent_opts
|
||||
|
@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import os
|
||||
|
||||
import mock
|
||||
from neutron.agent.l3 import legacy_router
|
||||
from neutron.conf.agent.l3 import config as l3_config
|
||||
from neutron.tests.functional import base
|
||||
|
@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import socket
|
||||
|
||||
import mock
|
||||
from neutron.db import l3_db
|
||||
from neutron_lib import context as n_ctx
|
||||
from neutron_lib import exceptions as nexception
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
|
||||
import mock
|
||||
from neutron.tests.unit.api.v2 import test_base as test_api_v2
|
||||
from neutron_lib.plugins import constants as nconstants
|
||||
|
@ -15,10 +15,10 @@
|
||||
import copy
|
||||
import difflib
|
||||
import io
|
||||
import mock
|
||||
import os
|
||||
import socket
|
||||
|
||||
import mock
|
||||
from neutron.agent.l3 import dvr_edge_router
|
||||
from neutron.agent.l3 import dvr_snat_ns
|
||||
from neutron.agent.l3 import legacy_router
|
||||
|
@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
|
||||
import concurrent.futures
|
||||
import exceptions
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
@ -330,7 +329,7 @@ class VpnBase(rally_base.OpenStackScenario):
|
||||
return resource
|
||||
time.sleep(check_interval)
|
||||
if time.time() - start_time > wait_timeout:
|
||||
raise exceptions.Exception(
|
||||
raise Exception(
|
||||
"Timeout waiting for resource {} to change to {} status".
|
||||
format(resource[resource_tag]['name'], final_status))
|
||||
|
||||
|
@ -12,13 +12,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import exceptions
|
||||
import os
|
||||
import paramiko
|
||||
import socket
|
||||
import stat
|
||||
import time
|
||||
|
||||
import paramiko
|
||||
from rally.common import logging
|
||||
from rally.plugins.openstack.wrappers import network as network_wrapper
|
||||
from rally.task import utils as task_utils
|
||||
@ -48,25 +47,21 @@ def execute_cmd_over_ssh(host, cmd, private_key):
|
||||
|
||||
client.connect(host["ip"], username=host["username"], pkey=k)
|
||||
except paramiko.BadHostKeyException as e:
|
||||
raise exceptions.Exception(
|
||||
"BADHOSTKEY EXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
raise Exception(
|
||||
"BADHOSTKEY EXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
except paramiko.AuthenticationException as e:
|
||||
raise exceptions.Exception(
|
||||
"AUTHENTICATION EXCEPTION WHEN CONNECTING TO %s",
|
||||
host["ip"], e)
|
||||
raise Exception(
|
||||
"AUTHENTICATION EXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
except paramiko.SSHException as e:
|
||||
raise exceptions.Exception(
|
||||
"SSH EXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
raise Exception("SSH EXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
except socket.error as e:
|
||||
raise exceptions.Exception(
|
||||
"SOCKET ERROR WHEN CONNECTING TO %s", host["ip"], e)
|
||||
raise Exception("SOCKET ERROR WHEN CONNECTING TO %s", host["ip"], e)
|
||||
LOG.debug("CONNECTED TO HOST <%s>", host["ip"])
|
||||
try:
|
||||
stdin, stdout, stderr = client.exec_command(cmd)
|
||||
return stdout.read().splitlines()
|
||||
except paramiko.SSHException as e:
|
||||
raise exceptions.Exception(
|
||||
"SSHEXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
raise Exception("SSHEXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
finally:
|
||||
client.close()
|
||||
|
||||
@ -237,7 +232,7 @@ def write_key_to_compute_node(keypair, local_path, remote_path, host,
|
||||
try:
|
||||
transport = paramiko.Transport(host['ip'], host['port'])
|
||||
except paramiko.SSHException as e:
|
||||
raise exceptions.Exception(
|
||||
raise Exception(
|
||||
"PARAMIKO TRANSPORT FAILED. CHECK IF THE HOST IP %s AND PORT %s "
|
||||
"ARE CORRECT %s", host['ip'], host['port'], e)
|
||||
try:
|
||||
@ -245,24 +240,22 @@ def write_key_to_compute_node(keypair, local_path, remote_path, host,
|
||||
username=host['username'], pkey=k)
|
||||
except paramiko.BadHostKeyException as e:
|
||||
transport.close()
|
||||
raise exceptions.Exception(
|
||||
"BADHOSTKEY EXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
raise Exception(
|
||||
"BADHOSTKEY EXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
except paramiko.AuthenticationException as e:
|
||||
transport.close()
|
||||
raise exceptions.Exception(
|
||||
"AUTHENTICATION EXCEPTION WHEN CONNECTING TO %s",
|
||||
host["ip"], e)
|
||||
raise Exception("AUTHENTICATION EXCEPTION WHEN CONNECTING TO %s",
|
||||
host["ip"], e)
|
||||
except paramiko.SSHException as e:
|
||||
transport.close()
|
||||
raise exceptions.Exception(
|
||||
"SSH EXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
raise Exception("SSH EXCEPTION WHEN CONNECTING TO %s", host["ip"], e)
|
||||
LOG.debug("CONNECTED TO HOST <%s>", host["ip"])
|
||||
|
||||
try:
|
||||
sftp_client = paramiko.SFTPClient.from_transport(transport)
|
||||
sftp_client.put(local_path, remote_path)
|
||||
except IOError as e:
|
||||
raise exceptions.Exception("FILE PATH DOESN'T EXIST", e)
|
||||
raise Exception("FILE PATH DOESN'T EXIST", e)
|
||||
finally:
|
||||
transport.close()
|
||||
|
||||
@ -391,8 +384,8 @@ def wait_for_namespace_creation(namespace_tag, router_id, hosts, private_key,
|
||||
return namespace_tag, host
|
||||
time.sleep(1)
|
||||
if time.time() - start_time > timeout:
|
||||
raise exceptions.Exception("TIMEOUT WHILE WAITING FOR"
|
||||
" NAMESPACES TO BE CREATED")
|
||||
raise Exception("TIMEOUT WHILE WAITING FOR"
|
||||
" NAMESPACES TO BE CREATED")
|
||||
|
||||
|
||||
def ping(host, cmd, private_key):
|
||||
|
@ -6,6 +6,7 @@ hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
astroid<1.4.0 # LGPLv2.1 # breaks pylint 1.4.4
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
flake8-import-order==0.12 # LGPLv3
|
||||
mock>=2.0 # BSD
|
||||
pylint==1.4.5 # GPLv2
|
||||
python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||
|
1
tox.ini
1
tox.ini
@ -90,6 +90,7 @@ commands = sphinx-build -W -b html doc/source doc/build
|
||||
ignore = E125,E126,E128,E129,E265,H404,H405,N530,N531
|
||||
show-source = true
|
||||
exclude = .venv,.git,.tox,dist,doc,.tmp,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios
|
||||
import-order-style = pep8
|
||||
|
||||
[hacking]
|
||||
import_exceptions = neutron_vpnaas._i18n
|
||||
|
Loading…
x
Reference in New Issue
Block a user