PY3: Ensure _refresh is passed str type for reason
Drop the use of oslo.i18n's Message class when defining the reason argument that is passed to _refresh(). Ensuing code that _refresh() uses, in particular pymysql [1], expects a unicode str type rather than an oslo_i18n._message.Message type. [1] https://github.com/PyMySQL/PyMySQL/blob/v0.9.2/pymysql/converters.py#L68 Change-Id: Icc59edc8a91ba7ae6929e853f1bf09bd25cdc039 Closes-Bug: #1799406
This commit is contained in:
parent
2e3589ebc4
commit
dbf6d2770d
|
@ -18,7 +18,6 @@ import stevedore
|
||||||
|
|
||||||
from aodh import evaluator
|
from aodh import evaluator
|
||||||
from aodh.evaluator import threshold
|
from aodh.evaluator import threshold
|
||||||
from aodh.i18n import _
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -177,14 +176,14 @@ class CompositeEvaluator(evaluator.Evaluator):
|
||||||
'rules': ', '.join(sorted(root_cause_rules)),
|
'rules': ', '.join(sorted(root_cause_rules)),
|
||||||
'description': STATE_CHANGE[new_state]}
|
'description': STATE_CHANGE[new_state]}
|
||||||
if transition:
|
if transition:
|
||||||
reason = (_('Composite rule alarm with composition form: '
|
reason = (('Composite rule alarm with composition form: '
|
||||||
'%(expression)s transition to %(state)s, due to '
|
'%(expression)s transition to %(state)s, due to '
|
||||||
'rules: %(rules)s %(description)s') % params)
|
'rules: %(rules)s %(description)s') % params)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
reason = (_('Composite rule alarm with composition form: '
|
reason = (('Composite rule alarm with composition form: '
|
||||||
'%(expression)s remaining as %(state)s, due to '
|
'%(expression)s remaining as %(state)s, due to '
|
||||||
'rules: %(rules)s %(description)s') % params)
|
'rules: %(rules)s %(description)s') % params)
|
||||||
|
|
||||||
return reason, reason_data
|
return reason, reason_data
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ from oslo_utils import timeutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from aodh import evaluator
|
from aodh import evaluator
|
||||||
from aodh.i18n import _
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -248,8 +247,8 @@ class EventAlarmEvaluator(evaluator.Evaluator):
|
||||||
"""Update alarm state and fire alarm via alarm notifier."""
|
"""Update alarm state and fire alarm via alarm notifier."""
|
||||||
|
|
||||||
state = evaluator.ALARM
|
state = evaluator.ALARM
|
||||||
reason = (_('Event <id=%(id)s,event_type=%(event_type)s> hits the '
|
reason = (('Event <id=%(id)s,event_type=%(event_type)s> hits the '
|
||||||
'query <query=%(alarm_query)s>.') %
|
'query <query=%(alarm_query)s>.') %
|
||||||
{'id': event.id,
|
{'id': event.id,
|
||||||
'event_type': event.get_value('event_type'),
|
'event_type': event.get_value('event_type'),
|
||||||
'alarm_query': json.dumps(alarm.obj.rule['query'],
|
'alarm_query': json.dumps(alarm.obj.rule['query'],
|
||||||
|
|
Loading…
Reference in New Issue