Skip to content

Commit

Permalink
Fix content type for qpid notifier.
Browse files Browse the repository at this point in the history
Fix bug 980872.

This patch fixes a regression I introduced in
2d36fac.  In that patch, I adjusted the
content_type for messages sent with the qpid notifier to be
'application/json' to match a change that went into the kombu notifier.
Unfortunately, it's wrong.

I assumed based on the kombu change that notifications were being json
encoded before being passed into the notification driver.  That's not
the case.  The message is a dict.  So, just revert the change to set the
content_type and let Qpid encode the notification as 'amqp/map'.

Change-Id: Iea027409f6200109b97fed93073cff84bc915536
  • Loading branch information
russellb committed Apr 24, 2012
1 parent a9fb224 commit 5bed23c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions glance/notifier/notify_qpid.py
Expand Up @@ -135,16 +135,13 @@ def _sender(self, priority):
return self.session.sender(address)

def warn(self, msg):
qpid_msg = qpid.messaging.Message(content=msg,
content_type='application/json')
qpid_msg = qpid.messaging.Message(content=msg)
self.sender_warn.send(qpid_msg)

def info(self, msg):
qpid_msg = qpid.messaging.Message(content=msg,
content_type='application/json')
qpid_msg = qpid.messaging.Message(content=msg)
self.sender_info.send(qpid_msg)

def error(self, msg):
qpid_msg = qpid.messaging.Message(content=msg,
content_type='application/json')
qpid_msg = qpid.messaging.Message(content=msg)
self.sender_error.send(qpid_msg)
2 changes: 1 addition & 1 deletion glance/tests/unit/test_notifier.py
Expand Up @@ -316,7 +316,7 @@ def tearDown(self):
super(TestQpidNotifier, self).tearDown()

def _test_notify(self, priority):
test_msg = json.dumps({'a': 'b'})
test_msg = {'a': 'b'}

self.mock_connection = self.mocker.CreateMock(self.orig_connection)
self.mock_session = self.mocker.CreateMock(self.orig_session)
Expand Down

0 comments on commit 5bed23c

Please sign in to comment.