Merge "Remove remaining log translation"

This commit is contained in:
Zuul
2025-09-01 10:32:24 +00:00
committed by Gerrit Code Review
8 changed files with 35 additions and 34 deletions

View File

@@ -192,7 +192,7 @@ class AlarmTimeConstraint(base.Base):
ALARMS_RULES = extension.ExtensionManager("aodh.alarm.rule")
LOG.debug("alarm rules plugin loaded: %s" % ",".join(ALARMS_RULES.names()))
LOG.debug("alarm rules plugin loaded: %s", ",".join(ALARMS_RULES.names()))
ACTIONS_SCHEMA = extension.ExtensionManager(
notifier.AlarmNotifierService.NOTIFIER_EXTENSIONS_NAMESPACE).names()

View File

@@ -158,7 +158,7 @@ class CompositeEvaluator(evaluator.Evaluator):
self.rule_targets.append(rule)
return AlarmEvaluation(rule), OkEvaluation(rule)
else:
LOG.error("Invalid rule type: %s" % alarm_rule['type'])
LOG.error("Invalid rule type: %s", alarm_rule['type'])
return False, False
def _reason(self, alarm, new_state, rule_target_alarm):

View File

@@ -91,9 +91,9 @@ class GnocchiResourceThresholdEvaluator(GnocchiBase):
rule['resource_id']),
[])
except Exception as e:
msg = 'alarm statistics retrieval failed: %s' % e
LOG.warning(msg)
raise threshold.InsufficientDataError(msg, [])
msg = 'alarm statistics retrieval failed: %s'
LOG.warning(msg, e)
raise threshold.InsufficientDataError(msg % e, [])
class GnocchiAggregationMetricsThresholdEvaluator(GnocchiBase):
@@ -136,9 +136,9 @@ class GnocchiAggregationMetricsThresholdEvaluator(GnocchiBase):
'metrics in %s' % (rule['aggregation_method'],
rule['metrics']), [])
except Exception as e:
msg = 'alarm statistics retrieval failed: %s' % e
LOG.warning(msg)
raise threshold.InsufficientDataError(msg, [])
msg = 'alarm statistics retrieval failed: %s'
LOG.warning(msg, e)
raise threshold.InsufficientDataError(msg % e, [])
class GnocchiAggregationResourcesThresholdEvaluator(GnocchiBase):
@@ -177,6 +177,6 @@ class GnocchiAggregationResourcesThresholdEvaluator(GnocchiBase):
'aggregation %s does not exist for at least one '
'metric of the query' % rule['aggregation_method'], [])
except Exception as e:
msg = 'alarm statistics retrieval failed: %s' % e
LOG.warning(msg)
raise threshold.InsufficientDataError(msg, [])
msg = 'alarm statistics retrieval failed: %s'
LOG.warning(msg, e)
raise threshold.InsufficientDataError(msg % e, [])

View File

@@ -51,7 +51,7 @@ class TrustHeatAlarmNotifier(notifier.AlarmNotifier):
LOG.info(
"Notifying alarm %(alarm_name)s %(alarm_id)s of %(severity)s "
"priority from %(previous)s to %(current)s with action %(action)s"
" because %(reason)s." %
" because %(reason)s.",
{'alarm_name': alarm_name,
'alarm_id': alarm_id,
'severity': severity,

View File

@@ -16,7 +16,6 @@
from oslo_log import log
from aodh.i18n import _
from aodh import notifier
LOG = log.getLogger(__name__)
@@ -28,13 +27,14 @@ class LogAlarmNotifier(notifier.AlarmNotifier):
@staticmethod
def notify(action, alarm_id, alarm_name, severity, previous, current,
reason, reason_data):
LOG.info(_(
LOG.info(
"Notifying alarm %(alarm_name)s %(alarm_id)s of %(severity)s "
"priority from %(previous)s to %(current)s with action %(action)s"
" because %(reason)s.") % ({'alarm_name': alarm_name,
'alarm_id': alarm_id,
'severity': severity,
'previous': previous,
'current': current,
'action': action.geturl(),
'reason': reason}))
" because %(reason)s.",
{'alarm_name': alarm_name,
'alarm_id': alarm_id,
'severity': severity,
'previous': previous,
'current': current,
'action': action.geturl(),
'reason': reason})

View File

@@ -67,11 +67,11 @@ class RestAlarmNotifier(notifier.AlarmNotifier):
LOG.info(
"Notifying alarm %(alarm_name)s %(alarm_id)s with severity"
" %(severity)s from %(previous)s to %(current)s with action "
"%(action)s because %(reason)s. request-id: %(request_id)s " %
({'alarm_name': alarm_name, 'alarm_id': alarm_id,
'severity': severity, 'previous': previous,
'current': current, 'action': action, 'reason': reason,
'request_id': headers['x-openstack-request-id']}))
"%(action)s because %(reason)s. request-id: %(request_id)s",
{'alarm_name': alarm_name, 'alarm_id': alarm_id,
'severity': severity, 'previous': previous,
'current': current, 'action': action, 'reason': reason,
'request_id': headers['x-openstack-request-id']})
body = {'alarm_name': alarm_name, 'alarm_id': alarm_id,
'severity': severity, 'previous': previous,
'current': current, 'reason': reason,

View File

@@ -134,13 +134,13 @@ class ZaqarAlarmNotifier(notifier.AlarmNotifier):
LOG.info(
"Notifying alarm %(alarm_name)s %(alarm_id)s of %(severity)s "
"priority from %(previous)s to %(current)s with action %(action)s"
" because %(reason)s." % ({'alarm_name': alarm_name,
'alarm_id': alarm_id,
'severity': severity,
'previous': previous,
'current': current,
'action': action,
'reason': reason}))
" because %(reason)s.", {'alarm_name': alarm_name,
'alarm_id': alarm_id,
'severity': severity,
'previous': previous,
'current': current,
'action': action,
'reason': reason})
body = {'alarm_name': alarm_name, 'alarm_id': alarm_id,
'severity': severity, 'previous': previous,
'current': current, 'reason': reason,

View File

@@ -89,7 +89,8 @@ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
# [H203] Use assertIs(Not)None to check for None.
# [H204] Use assert(Not)Equal to check for equality.
# [H205] Use assert(Greater|Less)(Equal) for comparison.
enable-extensions=H106,H203,H204,H205
# [H904] Delay string interpolations at logging calls.
enable-extensions=H106,H203,H204,H205,H904
show-source = True
[hacking]