From 11255ede9715800e2945e0b318c93a5ac9f1e968 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 15 May 2024 00:12:22 +0900 Subject: [PATCH] Fix the broken neutron gate There are currently two issues affecting the neutron gate, one for pep8 job and the other for fullstack. We need to fix them both together since they cannot merge separately. Bump pylint to the latest version to fix pep8 job - it was pinned to an old version which is causing the job to hang. Do not use str(url) to stringify a URL for subsequent use to fix the fullstack job. The str(url) function in SQLAlchemy hides the password. For a URL string that is to be re-used, use render_as_string(hide_password=False). Co-authored-by: Mike Bayer Closes-Bug: #2065779 Change-Id: I8d04db91ddc2995fbff05b4c4c48baebcc418522 --- .pylintrc | 1 + neutron/agent/linux/openvswitch_firewall/firewall.py | 3 +-- neutron/db/db_base_plugin_v2.py | 2 +- neutron/objects/router.py | 1 + .../plugins/ml2/drivers/openvswitch/agent/vlanmanager.py | 6 ++---- .../services/logapi/drivers/openvswitch/ovs_firewall_log.py | 3 +-- neutron/tests/fullstack/base.py | 4 +++- tox.ini | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.pylintrc b/.pylintrc index e1f6e275762..2206810ceb2 100644 --- a/.pylintrc +++ b/.pylintrc @@ -28,6 +28,7 @@ disable= no-method-argument, no-self-argument, not-an-iterable, + possibly-used-before-assignment, # "W" Warnings for stylistic problems or minor programming issues abstract-method, arguments-differ, diff --git a/neutron/agent/linux/openvswitch_firewall/firewall.py b/neutron/agent/linux/openvswitch_firewall/firewall.py index 960d1991f67..27797191a1d 100644 --- a/neutron/agent/linux/openvswitch_firewall/firewall.py +++ b/neutron/agent/linux/openvswitch_firewall/firewall.py @@ -1594,8 +1594,7 @@ class OVSFirewallDriver(firewall.FirewallDriver): def _create_rules_generator_for_port(self, port): for sec_group in port.sec_groups: - for rule in sec_group.raw_rules: - yield rule + yield from sec_group.raw_rules def _create_remote_rules_generator_for_port(self, port): for sec_group in port.sec_groups: diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index ca8bc9871e4..bf2bc2f230c 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -173,7 +173,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon, experimental.validate_experimental_enabled( c_exp.EXPERIMENTAL_IPV6_PD) except cfg.NoSuchOptError: - return + pass def __init__(self): self._validate_ipv6_pd() diff --git a/neutron/objects/router.py b/neutron/objects/router.py index 49f308b2db6..a94589bd94b 100644 --- a/neutron/objects/router.py +++ b/neutron/objects/router.py @@ -127,6 +127,7 @@ class RouterExtraAttributes(base.NeutronDbObject): l3_attrs.RouterExtraAttributes.router_id). join(l3.Router). group_by(binding_model.router_id).subquery()) + # pylint: disable=assignment-from-no-return count = func.coalesce(sub_query.c.count, 0) query = (context.session.query(l3.Router, count). outerjoin(sub_query).join(l3_attrs.RouterExtraAttributes). diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/vlanmanager.py b/neutron/plugins/ml2/drivers/openvswitch/agent/vlanmanager.py index 08d2a79ef62..2ae2cf6f3b0 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/vlanmanager.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/vlanmanager.py @@ -85,12 +85,10 @@ class LocalVlanManager(object): return key in self.mapping def __iter__(self): - for value in list(self.mapping.values()): - yield value + yield from list(self.mapping.values()) def items(self): - for item in self.mapping.items(): - yield item + yield from self.mapping.items() def add(self, net_id, vlan, network_type, physical_network, segmentation_id, vif_ports=None): diff --git a/neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py b/neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py index 63feb6a225a..14e652258d6 100644 --- a/neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py +++ b/neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py @@ -378,8 +378,7 @@ class OVSFirewallLoggingDriver(log_ext.LoggingDriver): ) def create_rules_generator_for_port(self, port): - for rule in port.secgroup_rules: - yield rule + yield from port.secgroup_rules def _create_conj_flows_log(self, remote_rule, port): ethertype = remote_rule['ethertype'] diff --git a/neutron/tests/fullstack/base.py b/neutron/tests/fullstack/base.py index ead831619b1..73f2ee8ac2d 100644 --- a/neutron/tests/fullstack/base.py +++ b/neutron/tests/fullstack/base.py @@ -66,7 +66,9 @@ class BaseFullStackTestCase(testlib_api.MySQLTestCaseMixin, # neutron server against this database. _orig_db_url = cfg.CONF.database.connection cfg.CONF.set_override( - 'connection', str(self.engine.url), group='database') + 'connection', + self.engine.url.render_as_string(hide_password=False), + group='database') self.addCleanup( cfg.CONF.set_override, "connection", _orig_db_url, group="database" diff --git a/tox.ini b/tox.ini index 2456e2719b6..1a295658a38 100644 --- a/tox.ini +++ b/tox.ini @@ -135,7 +135,7 @@ deps = bashate>=2.1.1 # Apache-2.0 bandit>=1.7.5 # Apache-2.0 flake8-import-order>=0.18.2,<0.19.0 # LGPLv3 - pylint==2.17.4 # GPLv2 + pylint==3.2.0 # GPLv2 commands= # If it is easier to add a check via a shell script, consider adding it in this file bash ./tools/misc-sanity-checks.sh