diff --git a/oslo/messaging/notify/_impl_log.py b/oslo/messaging/notify/_impl_log.py index 480c60339..b2ab7ff92 100644 --- a/oslo/messaging/notify/_impl_log.py +++ b/oslo/messaging/notify/_impl_log.py @@ -27,7 +27,7 @@ class LogDriver(notifier._Driver): LOGGER_BASE = 'oslo.messaging.notification' - def notify(self, context, message, priority): + def notify(self, ctxt, message, priority): logger = logging.getLogger('%s.%s' % (self.LOGGER_BASE, message['event_type'])) getattr(logger, priority)(jsonutils.dumps(message)) diff --git a/oslo/messaging/notify/_impl_messaging.py b/oslo/messaging/notify/_impl_messaging.py index 349dcf5de..f12fc498d 100644 --- a/oslo/messaging/notify/_impl_messaging.py +++ b/oslo/messaging/notify/_impl_messaging.py @@ -38,11 +38,11 @@ class MessagingDriver(notifier._Driver): super(MessagingDriver, self).__init__(conf, topics, transport) self.envelope = envelope - def notify(self, context, message, priority): + def notify(self, ctxt, message, priority): for topic in self.topics: target = messaging.Target(topic='%s.%s' % (topic, priority)) try: - self.transport._send(target, context, message, + self.transport._send(target, ctxt, message, envelope=self.envelope) except Exception: LOG.exception("Could not send notification to %(topic)s. " diff --git a/oslo/messaging/notify/_impl_noop.py b/oslo/messaging/notify/_impl_noop.py index b61cab235..d5bb1e7bc 100644 --- a/oslo/messaging/notify/_impl_noop.py +++ b/oslo/messaging/notify/_impl_noop.py @@ -20,5 +20,5 @@ from oslo.messaging.notify import notifier class NoOpDriver(notifier._Driver): - def notify(self, context, message, priority): + def notify(self, ctxt, message, priority): pass diff --git a/oslo/messaging/notify/_impl_test.py b/oslo/messaging/notify/_impl_test.py index 67bde6833..79e883e8e 100644 --- a/oslo/messaging/notify/_impl_test.py +++ b/oslo/messaging/notify/_impl_test.py @@ -26,5 +26,5 @@ class TestDriver(notifier._Driver): super(TestDriver, self).__init__(conf, **kwargs) self.notifications = [] - def notify(self, context, message, priority): + def notify(self, ctxt, message, priority): self.notifications.append(message) diff --git a/oslo/messaging/notify/notifier.py b/oslo/messaging/notify/notifier.py index 6949c2a74..29b400a1f 100644 --- a/oslo/messaging/notify/notifier.py +++ b/oslo/messaging/notify/notifier.py @@ -49,7 +49,7 @@ class _Driver(object): self.transport = transport @abc.abstractmethod - def notify(self, context, msg, priority): + def notify(self, ctxt, msg, priority): pass @@ -126,7 +126,7 @@ class Notifier(object): }, ) - def _notify(self, context, event_type, payload, priority): + def _notify(self, ctxt, event_type, payload, priority): msg = dict(message_id=uuidutils.generate_uuid(), publisher_id=self.publisher_id, event_type=event_type, @@ -136,69 +136,69 @@ class Notifier(object): def do_notify(ext): try: - ext.obj.notify(context, msg, priority) + ext.obj.notify(ctxt, msg, priority) except Exception as e: LOG.exception("Problem '%(e)s' attempting to send to " "notification system. Payload=%(payload)s", dict(e=e, payload=payload)) self._driver_mgr.map(do_notify) - def debug(self, context, event_type, payload): + def debug(self, ctxt, event_type, payload): """Send a notification at debug level. - :param context: a request context dict - :type context: dict + :param ctxt: a request context dict + :type ctxt: dict :param event_type: describes the event, e.g. 'compute.create_instance' :type event_type: str :param payload: the notification payload :type payload: dict """ - self._notify(context, event_type, payload, 'DEBUG') + self._notify(ctxt, event_type, payload, 'DEBUG') - def info(self, context, event_type, payload): + def info(self, ctxt, event_type, payload): """Send a notification at info level. - :param context: a request context dict - :type context: dict + :param ctxt: a request context dict + :type ctxt: dict :param event_type: describes the event, e.g. 'compute.create_instance' :type event_type: str :param payload: the notification payload :type payload: dict """ - self._notify(context, event_type, payload, 'INFO') + self._notify(ctxt, event_type, payload, 'INFO') - def warn(self, context, event_type, payload): + def warn(self, ctxt, event_type, payload): """Send a notification at warning level. - :param context: a request context dict - :type context: dict + :param ctxt: a request context dict + :type ctxt: dict :param event_type: describes the event, e.g. 'compute.create_instance' :type event_type: str :param payload: the notification payload :type payload: dict """ - self._notify(context, event_type, payload, 'WARN') + self._notify(ctxt, event_type, payload, 'WARN') - def error(self, context, event_type, payload): + def error(self, ctxt, event_type, payload): """Send a notification at error level. - :param context: a request context dict - :type context: dict + :param ctxt: a request context dict + :type ctxt: dict :param event_type: describes the event, e.g. 'compute.create_instance' :type event_type: str :param payload: the notification payload :type payload: dict """ - self._notify(context, event_type, payload, 'ERROR') + self._notify(ctxt, event_type, payload, 'ERROR') - def critical(self, context, event_type, payload): + def critical(self, ctxt, event_type, payload): """Send a notification at critical level. - :param context: a request context dict - :type context: dict + :param ctxt: a request context dict + :type ctxt: dict :param event_type: describes the event, e.g. 'compute.create_instance' :type event_type: str :param payload: the notification payload :type payload: dict """ - self._notify(context, event_type, payload, 'CRITICAL') + self._notify(ctxt, event_type, payload, 'CRITICAL')