Notify with string representation of alarm reason
Fixes bug 1227668 Ensure string representation of alarm reason is passed to the alarm notifier over RPC (as opposed to a gettextutils.Message instance). Change-Id: I6a840789f83068ee5721cb139b06cf0071240152
This commit is contained in:
parent
4a05b599b3
commit
f8796ee380
@ -44,5 +44,5 @@ class RPCAlarmNotifier(rpc_proxy.RpcProxy):
|
||||
'alarm_id': alarm.alarm_id,
|
||||
'previous': previous,
|
||||
'current': alarm.state,
|
||||
'reason': reason})
|
||||
'reason': unicode(reason)})
|
||||
self.cast(context.get_admin_context(), msg)
|
||||
|
@ -91,3 +91,8 @@ class TestRPCAlarmNotifier(base.TestCase):
|
||||
self.alarms[i].state)
|
||||
self.assertEqual(self.notified[i][1]["args"]["data"]["reason"],
|
||||
"what? %d" % i)
|
||||
|
||||
def test_notify_non_string_reason(self):
|
||||
self.notifier.notify(self.alarms[0], 'ok', 42)
|
||||
reason = self.notified[0][1]['args']['data']['reason']
|
||||
self.assertTrue(isinstance(reason, basestring))
|
||||
|
Loading…
x
Reference in New Issue
Block a user