Enable flake8-logging-format (G) rules
Should not use f-strings in lazy-format log messages. TrivialFix Change-Id: Ibfc8aaa61126a0145ec2d12d98d38b3bcc2ac7a7 Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
This commit is contained in:
@@ -117,7 +117,7 @@ class FdbPopulationAgentExtension(
|
||||
"""Perform FDB Agent Extension initialization."""
|
||||
if driver_type != ovs_constants.EXTENSION_DRIVER_TYPE:
|
||||
LOG.error('FDB extension is only supported for OVS agent, '
|
||||
f'currently uses {driver_type}')
|
||||
'currently uses %s', driver_type)
|
||||
sys.exit(1)
|
||||
|
||||
self.device_mappings = helpers.parse_mappings(
|
||||
|
||||
@@ -188,7 +188,7 @@ class MonitorDaemon(daemon.Daemon):
|
||||
elif state == 'backup':
|
||||
self.sync_conntrack_backup()
|
||||
else:
|
||||
LOG.error(f'Unknown state "{state}".')
|
||||
LOG.error('Unknown state "%s".', state)
|
||||
|
||||
def sync_conntrack_primary(self):
|
||||
|
||||
|
||||
@@ -1781,9 +1781,13 @@ class DeviceManager:
|
||||
|
||||
host_id = port.get(portbindings.HOST_ID)
|
||||
if host_id and host_id != self.conf.host:
|
||||
LOG.warning(f"Found stale port {port.id} for network "
|
||||
f"{network.id} bound to {host_id} that is "
|
||||
f"not us {self.conf.host}, deleting")
|
||||
LOG.warning("Found stale port %(port)s for network "
|
||||
"%(network)s bound to %(host_id)s that is "
|
||||
"not us %(host)s, deleting",
|
||||
{'port': port.id,
|
||||
'network': network.id,
|
||||
'hostid': host_id,
|
||||
'host': self.conf.host})
|
||||
try:
|
||||
self.unplug(dev_name, network)
|
||||
except Exception:
|
||||
|
||||
@@ -177,8 +177,8 @@ class BGPChassisBridge(Bridge):
|
||||
# The resulting openflows rules that will be written to a temporary
|
||||
# file and applied to the bridge.
|
||||
if not self.check_requirements_for_flows_met():
|
||||
LOG.error(f"Some of the requirements to install flows on bridge "
|
||||
f"{self.name} are missing, skipping")
|
||||
LOG.error("Some of the requirements to install flows on bridge "
|
||||
"%s are missing, skipping", self.name)
|
||||
return
|
||||
|
||||
LOG.debug("Configuring BGP bridge flows for %s", self.name)
|
||||
|
||||
@@ -81,8 +81,8 @@ class RPCNotifierHandler:
|
||||
|
||||
_method = getattr(self.notifier_instance, method_name, None)
|
||||
if not _method:
|
||||
LOG.warning(f'Method {method_name} is not implemented in the RPC '
|
||||
'notifier.')
|
||||
LOG.warning('Method %s is not implemented in the RPC notifier.',
|
||||
method_name)
|
||||
return null_method
|
||||
|
||||
return _method
|
||||
|
||||
@@ -1339,7 +1339,7 @@ def sync_ha_chassis_group_network_unified(context, nb_idl, sb_idl, network_id,
|
||||
|
||||
if missing_mappings:
|
||||
LOG.warning('The following chassis do not have mapped the '
|
||||
f'physical network {physnet}: {missing_mappings}')
|
||||
'physical network %s: %s', physnet, missing_mappings)
|
||||
|
||||
chassis_list = [sb_idl.lookup('Chassis', ch_name, None)
|
||||
for ch_name in chassis_prio.keys()]
|
||||
@@ -1501,7 +1501,7 @@ def ovs_persist_uuid_supported(nb_idl):
|
||||
if _OVS_PERSIST_UUID is _SENTINEL:
|
||||
_OVS_PERSIST_UUID = isinstance(
|
||||
next(iter(nb_idl.tables["NB_Global"].rows.data.values())), list)
|
||||
LOG.debug(f"OVS persist_uuid supported={_OVS_PERSIST_UUID}")
|
||||
LOG.debug("OVS persist_uuid supported=%s", _OVS_PERSIST_UUID)
|
||||
return _OVS_PERSIST_UUID
|
||||
|
||||
|
||||
|
||||
@@ -940,7 +940,7 @@ def timecost(f):
|
||||
|
||||
@timeutils.time_it(LOG, message=end_message, min_duration=None)
|
||||
def wrapper(*args, **kwargs):
|
||||
LOG.debug(message_base + "start")
|
||||
LOG.debug('%s start', message_base)
|
||||
ret = f(*args, **kwargs)
|
||||
return ret
|
||||
return wrapper
|
||||
|
||||
@@ -312,8 +312,12 @@ class AgentCache:
|
||||
else:
|
||||
agent_list.append(agent)
|
||||
for field, (field_type, value) in type_errors.items():
|
||||
LOG.info(f'Value "{value}" {type(value)} does not '
|
||||
f'match the OVN related agent field "{field}" '
|
||||
f'with type {field_type}')
|
||||
LOG.info('Value "%(value)s" %(vtype)s does not '
|
||||
'match the OVN related agent field "%(field)s" '
|
||||
'with type %(ftype)s',
|
||||
{'value': value,
|
||||
'vtype': type(value),
|
||||
'field': field,
|
||||
'ftype': field_type})
|
||||
|
||||
return agent_list
|
||||
|
||||
@@ -440,9 +440,9 @@ class Pinger:
|
||||
self.received = int(result.group('recv'))
|
||||
break
|
||||
else:
|
||||
LOG.error(f"Didn't find ping statistics:\n{output}")
|
||||
LOG.error("Did not find ping statistics:\n%s", output)
|
||||
raise RuntimeError("Didn't find ping statistics.")
|
||||
LOG.debug(f"ping command output:\n{output}")
|
||||
LOG.debug("ping command output:\n%s", output)
|
||||
|
||||
def start(self):
|
||||
if self.proc and self.proc.is_running:
|
||||
|
||||
@@ -274,13 +274,13 @@ class Host(fixtures.Fixture):
|
||||
self.tunnel_device.addr.flush(4)
|
||||
else:
|
||||
self.br_phys.delete_port(self.internal_port)
|
||||
LOG.info(f'Host {self.hostname} disconnected.')
|
||||
LOG.info('Host %s disconnected.', self.hostname)
|
||||
|
||||
def kill(self, parent=None):
|
||||
# First kill all the agent to prevent a graceful shutdown
|
||||
for agent_name, agent in self.agents.items():
|
||||
agent.stop(kill_signal=signal.SIGKILL)
|
||||
LOG.info(f'Agents on host {self.hostname} killed.')
|
||||
LOG.info('Agents on host %s killed.', self.hostname)
|
||||
|
||||
self.shutdown(parent)
|
||||
|
||||
@@ -293,7 +293,7 @@ class Host(fixtures.Fixture):
|
||||
(self.cleanUp, (), {})
|
||||
)
|
||||
|
||||
LOG.info(f'Host {self.hostname} shut down.')
|
||||
LOG.info('Host %s shut down.', self.hostname)
|
||||
|
||||
@property
|
||||
def hostname(self):
|
||||
|
||||
@@ -536,12 +536,12 @@ class TestHAL3Agent(TestL3Agent):
|
||||
|
||||
# Ensure connectivity is restored
|
||||
vm.block_until_ping(external.ip)
|
||||
LOG.debug(f'Connectivity restored after {datetime.now() - start}')
|
||||
LOG.debug('Connectivity restored after %s', datetime.now() - start)
|
||||
|
||||
# Ensure connection tracking states are synced to now active router
|
||||
netcat_tcp.test_connectivity()
|
||||
netcat_udp.test_connectivity()
|
||||
LOG.debug(f'Connections restored after {datetime.now() - start}')
|
||||
LOG.debug('Connections restored after %s', datetime.now() - start)
|
||||
|
||||
# Assert the backup host got active
|
||||
timeout = self.environment.env_desc.agent_down_time * 1.2
|
||||
@@ -549,7 +549,7 @@ class TestHAL3Agent(TestL3Agent):
|
||||
lambda: backup_host in get_active_hosts(),
|
||||
timeout=timeout,
|
||||
)
|
||||
LOG.debug(f'Active host asserted after {datetime.now() - start}')
|
||||
LOG.debug('Active host asserted after %s', datetime.now() - start)
|
||||
|
||||
if method in ('kill', 'shutdown'):
|
||||
# Assert the previously active host is no longer active if it was
|
||||
@@ -559,7 +559,8 @@ class TestHAL3Agent(TestL3Agent):
|
||||
lambda: active_host not in get_active_hosts(),
|
||||
timeout=timeout,
|
||||
)
|
||||
LOG.debug(f'Inactive host asserted after {datetime.now() - start}')
|
||||
LOG.debug('Inactive host asserted after %s',
|
||||
datetime.now() - start)
|
||||
|
||||
# Stop probing processes
|
||||
pinger.stop()
|
||||
|
||||
@@ -37,7 +37,7 @@ class TestRPCNotifierHandler(test_base.BaseTestCase):
|
||||
handler.notifier_instance = _RPCNotifier()
|
||||
self.assertIsNone(handler.method_2(1, arg2=2))
|
||||
mock_log.warning.assert_called_once_with(
|
||||
'Method method_2 is not implemented in the RPC notifier.')
|
||||
'Method %s is not implemented in the RPC notifier.', 'method_2')
|
||||
|
||||
def test_call_no_rpc_instance(self):
|
||||
handler = notifier_utils.RPCNotifierHandler()
|
||||
|
||||
@@ -364,7 +364,7 @@ exclude = "(?x)(^neutron/tests/$)"
|
||||
line-length = 79
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["E4", "E5", "E7", "E9", "F", "S", "UP"]
|
||||
select = ["E4", "E5", "E7", "E9", "F", "G", "S", "UP"]
|
||||
ignore = [
|
||||
"E741", # Ambiguous variable name: `l`
|
||||
"S104", # Possible binding to all interfaces
|
||||
|
||||
Reference in New Issue
Block a user