summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-11-05 21:06:05 +0000
committerGerrit Code Review <review@openstack.org>2012-11-05 21:06:05 +0000
commit37ada8bdb190f8e043003a41f67fff706cde332b (patch)
tree0f09c1f43f187ce5d4a1fff409bfd6746caae090
parent1691244b8e5b67e41799dec300f6e786cc4f16fa (diff)
parent5b86a006d823953daec121a3b6b4897d803e7e01 (diff)
downloadoslo-37ada8bdb190f8e043003a41f67fff706cde332b.tar.gz
oslo-37ada8bdb190f8e043003a41f67fff706cde332b.tar.xz
oslo-37ada8bdb190f8e043003a41f67fff706cde332b.zip
Merge "Rename rabbit_notifier to rpc_notifier."
-rw-r--r--openstack/common/notifier/rabbit_notifier.py31
-rw-r--r--openstack/common/notifier/rpc_notifier.py46
2 files changed, 53 insertions, 24 deletions
diff --git a/openstack/common/notifier/rabbit_notifier.py b/openstack/common/notifier/rabbit_notifier.py
index 3a2ffee..56a37e4 100644
--- a/openstack/common/notifier/rabbit_notifier.py
+++ b/openstack/common/notifier/rabbit_notifier.py
@@ -1,4 +1,4 @@
-# Copyright 2011 OpenStack LLC.
+# Copyright 2012 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -14,33 +14,16 @@
# under the License.
-from openstack.common import cfg
-from openstack.common import context as req_context
from openstack.common.gettextutils import _
from openstack.common import log as logging
-from openstack.common import rpc
+from openstack.common.notifier import rpc_notifier
LOG = logging.getLogger(__name__)
-notification_topic_opt = cfg.ListOpt(
- 'notification_topics', default=['notifications', ],
- help='AMQP topic used for openstack notifications')
-
-CONF = cfg.CONF
-CONF.register_opt(notification_topic_opt)
-
def notify(context, message):
- """Sends a notification to the RabbitMQ"""
- if not context:
- context = req_context.get_admin_context()
- priority = message.get('priority',
- CONF.default_notification_level)
- priority = priority.lower()
- for topic in CONF.notification_topics:
- topic = '%s.%s' % (topic, priority)
- try:
- rpc.notify(context, topic, message)
- except Exception, e:
- LOG.exception(_("Could not send notification to %(topic)s. "
- "Payload=%(message)s"), locals())
+ """Deprecated in Grizzly. Please use rpc_notifier instead."""
+
+ LOG.deprecated(_("The rabbit_notifier is now deprecated."
+ " Please use rpc_notifier instead."))
+ rpc_notifier.notify(context, message)
diff --git a/openstack/common/notifier/rpc_notifier.py b/openstack/common/notifier/rpc_notifier.py
new file mode 100644
index 0000000..604af86
--- /dev/null
+++ b/openstack/common/notifier/rpc_notifier.py
@@ -0,0 +1,46 @@
+# Copyright 2011 OpenStack LLC.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from openstack.common import cfg
+from openstack.common import context as req_context
+from openstack.common.gettextutils import _
+from openstack.common import log as logging
+from openstack.common import rpc
+
+LOG = logging.getLogger(__name__)
+
+notification_topic_opt = cfg.ListOpt(
+ 'notification_topics', default=['notifications', ],
+ help='AMQP topic used for openstack notifications')
+
+CONF = cfg.CONF
+CONF.register_opt(notification_topic_opt)
+
+
+def notify(context, message):
+ """Sends a notification via RPC"""
+ if not context:
+ context = req_context.get_admin_context()
+ priority = message.get('priority',
+ CONF.default_notification_level)
+ priority = priority.lower()
+ for topic in CONF.notification_topics:
+ topic = '%s.%s' % (topic, priority)
+ try:
+ rpc.notify(context, topic, message)
+ except Exception, e:
+ LOG.exception(_("Could not send notification to %(topic)s. "
+ "Payload=%(message)s"), locals())