Bump hacking

hacking 3.0.x is too old.
Try to synchronize pylint ignore and extension list with
other Networking projects.

With new pip the order of packages is not relevant, so the
related comment from requirements.txts is removed, see pip
documentation:
https://pip.pypa.io/en/stable/cli/pip_install/#installation-order

Change-Id: I99a2d30149088d3d71d56351d180e665c38686ef
This commit is contained in:
elajkat 2024-02-06 15:17:56 +01:00 committed by Lajos Katona
parent 3fe92291f2
commit 625b6526ca
19 changed files with 111 additions and 126 deletions

View File

@ -54,8 +54,7 @@ def get_inspector():
def get_tables(): def get_tables():
""" """Returns hardcoded list of tables which have ``tenant_id`` column.
Returns hardcoded list of tables which have ``tenant_id`` column.
The list is hardcoded to match the state of the schema when this The list is hardcoded to match the state of the schema when this
upgrade script is run. upgrade script is run.

View File

@ -145,8 +145,7 @@ class Firewall_v2(extensions.APIExtensionDescriptor):
return Firewallv2PluginBase return Firewallv2PluginBase
class Firewallv2PluginBase( class Firewallv2PluginBase(service_base.ServicePluginBase,
service_base.ServicePluginBase,
metaclass=abc.ABCMeta): metaclass=abc.ABCMeta):
def get_plugin_type(self): def get_plugin_type(self):

View File

@ -314,7 +314,7 @@ class FirewallAgentDriver(driver_api.FirewallDriverDB,
# the old group had the same number of ports that need to be deleted. # the old group had the same number of ports that need to be deleted.
fwg_with_rules['last-port'] = (len(old_firewall_group['ports']) == len( fwg_with_rules['last-port'] = (len(old_firewall_group['ports']) == len(
fwg_with_rules['del-port-ids']) and fwg_with_rules['del-port-ids']) and
not(new_firewall_group['ports'])) not new_firewall_group['ports'])
LOG.debug("update_firewall_group %s: Add Ports: %s, Del Ports: %s", LOG.debug("update_firewall_group %s: Add Ports: %s, Del Ports: %s",
new_firewall_group['id'], new_firewall_group['id'],

View File

@ -543,7 +543,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
def _ip_prefix_arg(self, direction, ip_prefix): def _ip_prefix_arg(self, direction, ip_prefix):
if not(ip_prefix): if not ip_prefix:
return [] return []
args = ['-%s' % direction, '%s' % utils.ip_to_cidr(ip_prefix)] args = ['-%s' % direction, '%s' % utils.ip_to_cidr(ip_prefix)]

View File

@ -441,7 +441,7 @@ class FirewallDriverDB(FirewallDriverDBMixin):
related records in the databases. related records in the databases.
""" """
#Firewal Group # Firewall Group
def create_firewall_group_precommit(self, context, firewall_group): def create_firewall_group_precommit(self, context, firewall_group):
pass pass

View File

@ -269,7 +269,8 @@ class Environment(fixtures.Fixture):
""" """
def __init__(self, env_desc, hosts_desc): def __init__(self, env_desc, hosts_desc):
""" """Environment, represents a deployment topology
:param env_desc: An EnvironmentDescription instance. :param env_desc: An EnvironmentDescription instance.
:param hosts_desc: A list of HostDescription instances. :param hosts_desc: A list of HostDescription instances.
""" """

View File

@ -393,7 +393,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
self.assertEqual(webob.exc.HTTPConflict.code, res.status_int) self.assertEqual(webob.exc.HTTPConflict.code, res.status_int)
def test_update_default_fwg_policy(self): def test_update_default_fwg_policy(self):
""" """Test that fw group associated policy can't be updated
Make sure that neither admin nor non-admin can update policy Make sure that neither admin nor non-admin can update policy
associated with default firewall group associated with default firewall group
""" """
@ -848,8 +849,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
self._test_create_firewall_group(attrs) self._test_create_firewall_group(attrs)
def test_create_firewall_group_with_router_port_l3ha(self): def test_create_firewall_group_with_router_port_l3ha(self):
with self.port( dev_owner_ha_repl_int = nl_constants.DEVICE_OWNER_HA_REPLICATED_INT
device_owner=nl_constants.DEVICE_OWNER_HA_REPLICATED_INT) as port: with self.port(device_owner=dev_owner_ha_repl_int) as port:
attrs = self._get_test_firewall_group_attrs("fwg1") attrs = self._get_test_firewall_group_attrs("fwg1")
attrs['ports'] = [port['port']['id']] attrs['ports'] = [port['port']['id']]
self._test_create_firewall_group(attrs) self._test_create_firewall_group(attrs)
@ -993,7 +994,7 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
for rule_id in policy['firewall_rules']: for rule_id in policy['firewall_rules']:
rule = self._show_req( rule = self._show_req(
'firewall_rules', rule_id)['firewall_rule'] 'firewall_rules', rule_id)['firewall_rule']
self.assertTrue(direction in rule["description"]) self.assertIn(direction, rule["description"])
for obj in result_map: for obj in result_map:
res = self._list_req(obj) res = self._list_req(obj)
@ -1098,8 +1099,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
def test_show_firewall_group_with_ports(self): def test_show_firewall_group_with_ports(self):
attrs = self._get_test_firewall_group_attrs('fwg1') attrs = self._get_test_firewall_group_attrs('fwg1')
with self.port( dev_owner_router_intf = nl_constants.DEVICE_OWNER_ROUTER_INTF
device_owner=nl_constants.DEVICE_OWNER_ROUTER_INTF) as dummy_port: with self.port(device_owner=dev_owner_router_intf) as dummy_port:
attrs['ports'] = [dummy_port['port']['id']] attrs['ports'] = [dummy_port['port']['id']]
self._test_show_firewall_group(attrs) self._test_show_firewall_group(attrs)
@ -1272,7 +1273,8 @@ class TestFirewallDBPluginV2(test_fwaas_plugin_v2.FirewallPluginV2TestCase):
self.assertEqual(200, res.status_int) self.assertEqual(200, res.status_int)
def test_change_fwg_name_to_default(self): def test_change_fwg_name_to_default(self):
""" """Test that fw group name can't be changed
Make sure that neither admin nor non-admin can change name of Make sure that neither admin nor non-admin can change name of
existing firewall group to default existing firewall group to default
""" """

View File

@ -185,7 +185,8 @@ class ConntrackNetlinkTestCase(base.BaseTestCase):
not_in_dport_range = [(4, 'tcp', 1, 2, '1.1.1.1', '2.2.2.2'), not_in_dport_range = [(4, 'tcp', 1, 2, '1.1.1.1', '2.2.2.2'),
(4, 'tcp', [1], ['3', '100']), -1] (4, 'tcp', [1], ['3', '100']), -1]
for entry, rule_filter, expect in [ for entry, rule_filter, expect in [
wrong_ipv, wrong_proto, not_in_sport_range, not_in_dport_range]: wrong_ipv, wrong_proto, not_in_sport_range,
not_in_dport_range]:
self._test_entry_to_delete(rule_filter, entry, expect) self._test_entry_to_delete(rule_filter, entry, expect)
def test_get_filter_from_rules(self): def test_get_filter_from_rules(self):

View File

@ -40,9 +40,10 @@ DELETEFW_PATH = (FIREWALL_AGENT_PLUGIN + '.FirewallAgentApi.'
class FakeAgentApi(agents.FirewallAgentCallbacks): class FakeAgentApi(agents.FirewallAgentCallbacks):
""" """This class used to mock the AgentAPI delete method
This class used to mock the AgentAPI delete method inherits from
FirewallCallbacks because it needs access to the firewall_deleted method. It inherits from FirewallCallbacks because it needs access to
the firewall_deleted method.
The delete_firewall method belongs to the FirewallAgentApi, which has The delete_firewall method belongs to the FirewallAgentApi, which has
no access to the firewall_deleted method normally because it's not no access to the firewall_deleted method normally because it's not
responsible for deleting the firewall from the DB. However, it needs responsible for deleting the firewall from the DB. However, it needs

View File

@ -1,12 +1,3 @@
# Requirements lower bounds listed here are our best effort to keep them up to
# date but we do not test them so no guarantee of having them all correct. If
# you find any incorrect lower bounds, let us know or propose a fix.
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=4.0.0 # Apache-2.0
eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
netaddr>=0.7.18 # BSD netaddr>=0.7.18 # BSD
SQLAlchemy>=1.4.23 # MIT SQLAlchemy>=1.4.23 # MIT

View File

@ -1,10 +1,6 @@
# The order of packages is significant, because pip processes them in the order hacking>=6.1.0,<6.2.0 # Apache-2.0
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=3.0.1,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
flake8-import-order==0.12 # LGPLv3
python-subunit>=1.0.0 # Apache-2.0/BSD python-subunit>=1.0.0 # Apache-2.0/BSD
requests-mock>=1.2.0 # Apache-2.0 requests-mock>=1.2.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0 oslo.concurrency>=3.26.0 # Apache-2.0
@ -15,6 +11,7 @@ testscenarios>=0.4 # Apache-2.0/BSD
WebOb>=1.8.2 # MIT WebOb>=1.8.2 # MIT
WebTest>=2.0.27 # MIT WebTest>=2.0.27 # MIT
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0
pylint==2.17.4 # GPLv2
PyMySQL>=0.7.6 # MIT License PyMySQL>=0.7.6 # MIT License
psycopg2>=2.7.3 # LGPL/ZPL psycopg2>=2.7.3 # LGPL/ZPL
ddt>=1.0.1 # MIT ddt>=1.0.1 # MIT

20
tox.ini
View File

@ -151,26 +151,20 @@ ignore = D000
ignore-path = .venv,.git,.tox,.tmp,*neutron_fwaas/locale*,*lib/python*,neutron_fwaas.egg*,doc/build,releasenotes/*,doc/source/contributor/api,requirements.txt,test-requirements.txt ignore-path = .venv,.git,.tox,.tmp,*neutron_fwaas/locale*,*lib/python*,neutron_fwaas.egg*,doc/build,releasenotes/*,doc/source/contributor/api,requirements.txt,test-requirements.txt
[flake8] [flake8]
# E125 continuation line does not distinguish itself from next logical line # N530 direct neutron imports not allowed
# W504 Line break occurred after a binary operator
# E126 continuation line over-indented for hanging indent # E126 continuation line over-indented for hanging indent
# 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
# E265 block comment should start with '# '
# H404 multi line docstring should start with a summary
# H405 multi line docstring summary not separated with an empty line # H405 multi line docstring summary not separated with an empty line
# TODO(dougwig) -- uncomment this to test for remaining linkages # I202 Additional newline in a group of imports
# N530 direct neutron imports not allowed # E731 do not assign a lambda expression, use a def
# TODO(ihrachys) -- reenable N537 when new neutron-lib release is available # W504 line break after binary operator
# H106: Do not put vim configuration in source files ignore = E126,E128,E731,I202,H405,N530,W504
# H106: Don't put vim configuration in source files
# H203: Use assertIs(Not)None to check for None # H203: Use assertIs(Not)None to check for None
# H204: Use assert(Not)Equal to check for equality # H204: Use assert(Not)Equal to check for equality
# H205: Use assert(Greater|Less)(Equal) for comparison # H205: Use assert(Greater|Less)(Equal) for comparison
# H904: Delay string interpolations at logging calls # H904: Delay string interpolations at logging calls
# N521: jsonutils.loads must be used instead of json.loads
# W504 line break after binary operator
# (W503 and W504 are incompatible and we need to choose one of them.
# Existing codes follows W503, so we disable W504.)
ignore = E125,E126,E128,E129,E265,H404,H405,N530,N521,W504
enable-extensions=H106,H203,H204,H205,H904 enable-extensions=H106,H203,H204,H205,H904
show-source = true show-source = true
exclude = .venv,.git,.tox,dist,doc,*lib/python*,.tmp,*egg,build,tools,.ropeproject,rally-scenarios exclude = .venv,.git,.tox,dist,doc,*lib/python*,.tmp,*egg,build,tools,.ropeproject,rally-scenarios