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