More unit tests and rabbit hooks

This commit is contained in:
matt.dietz@rackspace.com
2011-03-04 19:24:55 +00:00
parent 8122a365f7
commit d16bf1c179
5 changed files with 53 additions and 15 deletions

View File

@@ -13,12 +13,25 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import nova.context
from nova import flags
from nova import rpc
FLAGS = flags.FLAGS
flags.DEFINE_string('notification_topic', 'notifications',
'RabbitMQ topic used for Nova notifications')
class RabbitNotifier(object):
"""Sends notifications to a specific RabbitMQ server and topic"""
pass
def __init__(self):
pass
def notify(self, model):
def notify(self, event_name, model):
"""Sends a notification to the RabbitMQ"""
pass
context = nova.context.get_admin_context()
topic = FLAGS.notification_topic
msg = { 'event_name': event_name, 'model': model.__dict__ }
rpc.cast(context, topic, json.dumps(msg))