From 4757b466466ac555bda67e341634c4d977daa081 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Sun, 7 May 2023 23:13:32 -0400 Subject: [PATCH] Fix some new pylint "W" warnings After updating pylint, it started emitting additional "W" warnings in some cases, fix some of them. modified-iterating-list, implicit-str-concat, global-variable-not-assigned Trivialfix Change-Id: I7deb5f1e0aa2852cb033c78dcb4c8bc87e34be1e --- .pylintrc | 3 --- neutron/agent/linux/iptables_firewall.py | 2 +- neutron/common/utils.py | 2 +- .../plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py | 2 +- neutron/services/trunk/drivers/openvswitch/agent/driver.py | 5 +---- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.pylintrc b/.pylintrc index 28706a4a12d..34b883eb6f7 100644 --- a/.pylintrc +++ b/.pylintrc @@ -59,13 +59,10 @@ disable= raise-missing-from, arguments-renamed, broad-exception-raised, - modified-iterating-list, unspecified-encoding, missing-timeout, - implicit-str-concat, redundant-u-string-prefix, unused-private-member, - global-variable-not-assigned, # "C" Coding convention violations consider-iterating-dictionary, consider-using-enumerate, diff --git a/neutron/agent/linux/iptables_firewall.py b/neutron/agent/linux/iptables_firewall.py index 631fcc6bc12..53b2640cd40 100644 --- a/neutron/agent/linux/iptables_firewall.py +++ b/neutron/agent/linux/iptables_firewall.py @@ -731,7 +731,7 @@ class IptablesFirewallDriver(firewall.FirewallDriver): def _drop_invalid_packets(self, iptables_rules): # Always drop invalid packets - iptables_rules += [comment_rule('-m state --state ' 'INVALID -j DROP', + iptables_rules += [comment_rule('-m state --state INVALID -j DROP', comment=ic.INVALID_DROP)] return iptables_rules diff --git a/neutron/common/utils.py b/neutron/common/utils.py index 4c240584f11..fe308778896 100644 --- a/neutron/common/utils.py +++ b/neutron/common/utils.py @@ -769,7 +769,7 @@ def attach_exc_details(e, msg, args=_NO_ARGS_MARKER): def extract_exc_details(e): for attr in ('_error_context_msg', '_error_context_args'): if not hasattr(e, attr): - return u'No details.' + return 'No details.' details = e._error_context_msg args = e._error_context_args if args is _NO_ARGS_MARKER: diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py index f53bc8423b5..3790f1a0282 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_db_sync.py @@ -284,7 +284,7 @@ class OvnNbSynchronizer(OvnDbSynchronizer): # Remove the common ones for na in list(neutron_acls): - for ovn_a in ovn_acls: + for ovn_a in ovn_acls.copy(): if all(item in na.items() for item in ovn_a.items()): neutron_acls.remove(na) ovn_acls.remove(ovn_a) diff --git a/neutron/services/trunk/drivers/openvswitch/agent/driver.py b/neutron/services/trunk/drivers/openvswitch/agent/driver.py index c24ac62d2bc..68e43422090 100644 --- a/neutron/services/trunk/drivers/openvswitch/agent/driver.py +++ b/neutron/services/trunk/drivers/openvswitch/agent/driver.py @@ -104,8 +104,5 @@ def init_handler(resource, event, trigger, payload=None): def unregister(): """Cleanup fanout queues""" - global TRUNK_SKELETON - try: + if TRUNK_SKELETON: TRUNK_SKELETON.unregister() - except AttributeError: - pass