Merge "enable F402 check for flake8"
This commit is contained in:
commit
3b072ee1d0
@ -18,7 +18,7 @@ from sqlalchemy import orm
|
|||||||
from sqlalchemy.orm import exc
|
from sqlalchemy.orm import exc
|
||||||
from sqlalchemy.orm import scoped_session
|
from sqlalchemy.orm import scoped_session
|
||||||
|
|
||||||
from neutron.api.v2 import attributes as attr
|
from neutron.api.v2 import attributes
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.db import db_base_plugin_v2
|
from neutron.db import db_base_plugin_v2
|
||||||
from neutron.db import model_base
|
from neutron.db import model_base
|
||||||
@ -481,11 +481,11 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
|||||||
|
|
||||||
# Register dict extend functions for ports
|
# Register dict extend functions for ports
|
||||||
db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
|
db_base_plugin_v2.NeutronDbPluginV2.register_dict_extend_funcs(
|
||||||
attr.PORTS, ['_extend_port_dict_security_group'])
|
attributes.PORTS, ['_extend_port_dict_security_group'])
|
||||||
|
|
||||||
def _process_port_create_security_group(self, context, port,
|
def _process_port_create_security_group(self, context, port,
|
||||||
security_group_ids):
|
security_group_ids):
|
||||||
if attr.is_attr_set(security_group_ids):
|
if attributes.is_attr_set(security_group_ids):
|
||||||
for security_group_id in security_group_ids:
|
for security_group_id in security_group_ids:
|
||||||
self._create_port_security_group_binding(context, port['id'],
|
self._create_port_security_group_binding(context, port['id'],
|
||||||
security_group_id)
|
security_group_id)
|
||||||
@ -517,7 +517,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
|||||||
:returns: all security groups IDs on port belonging to tenant.
|
:returns: all security groups IDs on port belonging to tenant.
|
||||||
"""
|
"""
|
||||||
p = port['port']
|
p = port['port']
|
||||||
if not attr.is_attr_set(p.get(ext_sg.SECURITYGROUPS)):
|
if not attributes.is_attr_set(p.get(ext_sg.SECURITYGROUPS)):
|
||||||
return
|
return
|
||||||
if p.get('device_owner') and p['device_owner'].startswith('network:'):
|
if p.get('device_owner') and p['device_owner'].startswith('network:'):
|
||||||
return
|
return
|
||||||
@ -546,7 +546,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
|||||||
tenant_id = self._get_tenant_id_for_create(context,
|
tenant_id = self._get_tenant_id_for_create(context,
|
||||||
port['port'])
|
port['port'])
|
||||||
default_sg = self._ensure_default_security_group(context, tenant_id)
|
default_sg = self._ensure_default_security_group(context, tenant_id)
|
||||||
if attr.is_attr_set(port['port'].get(ext_sg.SECURITYGROUPS)):
|
if attributes.is_attr_set(port['port'].get(ext_sg.SECURITYGROUPS)):
|
||||||
sgids = port['port'].get(ext_sg.SECURITYGROUPS)
|
sgids = port['port'].get(ext_sg.SECURITYGROUPS)
|
||||||
else:
|
else:
|
||||||
sgids = [default_sg]
|
sgids = [default_sg]
|
||||||
@ -557,7 +557,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
|||||||
is either [] or not is_attr_set, otherwise return False
|
is either [] or not is_attr_set, otherwise return False
|
||||||
"""
|
"""
|
||||||
if (ext_sg.SECURITYGROUPS in port['port'] and
|
if (ext_sg.SECURITYGROUPS in port['port'] and
|
||||||
not (attr.is_attr_set(port['port'][ext_sg.SECURITYGROUPS])
|
not (attributes.is_attr_set(port['port'][ext_sg.SECURITYGROUPS])
|
||||||
and port['port'][ext_sg.SECURITYGROUPS] != [])):
|
and port['port'][ext_sg.SECURITYGROUPS] != [])):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@ -567,7 +567,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
|||||||
security_group field is is_attr_set or [].
|
security_group field is is_attr_set or [].
|
||||||
"""
|
"""
|
||||||
if (ext_sg.SECURITYGROUPS in port['port'] and
|
if (ext_sg.SECURITYGROUPS in port['port'] and
|
||||||
(attr.is_attr_set(port['port'][ext_sg.SECURITYGROUPS]) and
|
(attributes.is_attr_set(port['port'][ext_sg.SECURITYGROUPS]) and
|
||||||
port['port'][ext_sg.SECURITYGROUPS] != [])):
|
port['port'][ext_sg.SECURITYGROUPS] != [])):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -211,12 +211,12 @@ class AgentDBTestCase(AgentDBTestMixIn,
|
|||||||
def test_list_agent(self):
|
def test_list_agent(self):
|
||||||
agents = self._register_agent_states()
|
agents = self._register_agent_states()
|
||||||
res = self._list('agents')
|
res = self._list('agents')
|
||||||
for agent in res['agents']:
|
for agt in res['agents']:
|
||||||
if (agent['host'] == DHCP_HOSTA and
|
if (agt['host'] == DHCP_HOSTA and
|
||||||
agent['agent_type'] == constants.AGENT_TYPE_DHCP):
|
agt['agent_type'] == constants.AGENT_TYPE_DHCP):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'dhcp_driver',
|
'dhcp_driver',
|
||||||
agent['configurations']['dhcp_driver'])
|
agt['configurations']['dhcp_driver'])
|
||||||
break
|
break
|
||||||
self.assertEqual(len(agents), len(res['agents']))
|
self.assertEqual(len(agents), len(res['agents']))
|
||||||
|
|
||||||
|
@ -787,9 +787,9 @@ class TestBasicRouterOperations(base.BaseTestCase):
|
|||||||
def _verify_snat_rules(self, rules, router, negate=False):
|
def _verify_snat_rules(self, rules, router, negate=False):
|
||||||
interfaces = router[l3_constants.INTERFACE_KEY]
|
interfaces = router[l3_constants.INTERFACE_KEY]
|
||||||
source_cidrs = []
|
source_cidrs = []
|
||||||
for interface in interfaces:
|
for iface in interfaces:
|
||||||
prefix = interface['subnet']['cidr'].split('/')[1]
|
prefix = iface['subnet']['cidr'].split('/')[1]
|
||||||
source_cidr = "%s/%s" % (interface['fixed_ips'][0]['ip_address'],
|
source_cidr = "%s/%s" % (iface['fixed_ips'][0]['ip_address'],
|
||||||
prefix)
|
prefix)
|
||||||
source_cidrs.append(source_cidr)
|
source_cidrs.append(source_cidr)
|
||||||
source_nat_ip = router['gw_port']['fixed_ips'][0]['ip_address']
|
source_nat_ip = router['gw_port']['fixed_ips'][0]['ip_address']
|
||||||
|
3
tox.ini
3
tox.ini
@ -65,7 +65,6 @@ commands = python setup.py build_sphinx
|
|||||||
# E128 continuation line under-indented for visual indent
|
# E128 continuation line under-indented for visual indent
|
||||||
# E129 visually indented line with same indent as next logical line
|
# E129 visually indented line with same indent as next logical line
|
||||||
# E265 block comment should start with ‘# ‘
|
# E265 block comment should start with ‘# ‘
|
||||||
# F402 import module shadowed by loop variable
|
|
||||||
# F811 redefinition of unused variable
|
# F811 redefinition of unused variable
|
||||||
# F812 list comprehension redefines name from line
|
# F812 list comprehension redefines name from line
|
||||||
# H237 module is removed in Python 3
|
# H237 module is removed in Python 3
|
||||||
@ -76,7 +75,7 @@ commands = python setup.py build_sphinx
|
|||||||
# H405 multi line docstring summary not separated with an empty line
|
# H405 multi line docstring summary not separated with an empty line
|
||||||
# H904 Wrap long lines in parentheses instead of a backslash
|
# H904 Wrap long lines in parentheses instead of a backslash
|
||||||
# TODO(marun) H404 multi line docstring should start with a summary
|
# TODO(marun) H404 multi line docstring should start with a summary
|
||||||
ignore = E125,E126,E128,E129,E265,F402,F811,F812,H237,H305,H307,H401,H402,H404,H405,H904
|
ignore = E125,E126,E128,E129,E265,F811,F812,H237,H305,H307,H401,H402,H404,H405,H904
|
||||||
show-source = true
|
show-source = true
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios
|
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios
|
||||||
|
Loading…
Reference in New Issue
Block a user