diff --git a/monasca_notification/notification_engine.py b/monasca_notification/notification_engine.py index 345d350..3201921 100644 --- a/monasca_notification/notification_engine.py +++ b/monasca_notification/notification_engine.py @@ -47,7 +47,7 @@ class NotificationEngine(object): def _add_periodic_notifications(self, notifications): for notification in notifications: period = str(notification.period) - if period in CONF.kafka.periodic.keys() and notification.type == "webhook": + if period in CONF.kafka.periodic.keys(): notification.notification_timestamp = time.time() self._producer.publish(CONF.kafka.periodic[period], [notification.to_json()]) diff --git a/monasca_notification/periodic_engine.py b/monasca_notification/periodic_engine.py index 686ca36..25c252e 100644 --- a/monasca_notification/periodic_engine.py +++ b/monasca_notification/periodic_engine.py @@ -52,7 +52,7 @@ class PeriodicEngine(object): self._db_repo = get_db_repo() self._period = period - def _keep_sending(self, alarm_id, original_state, type, period): + def _keep_sending(self, alarm_id, original_state, period): try: current_state = self._db_repo.get_alarm_current_state(alarm_id) except exceptions.DatabaseException: @@ -68,8 +68,6 @@ class PeriodicEngine(object): # Period changed if period != self._period: return False - if type != "webhook": - return False return True @@ -86,7 +84,6 @@ class PeriodicEngine(object): if self._keep_sending(notification.alarm_id, notification.state, - notification.type, notification.period): wait_duration = notification.period - ( diff --git a/releasenotes/notes/allow_periodic_notifications_for_all_notification_types-ce399a32e5d0f4d3.yaml b/releasenotes/notes/allow_periodic_notifications_for_all_notification_types-ce399a32e5d0f4d3.yaml new file mode 100644 index 0000000..0859deb --- /dev/null +++ b/releasenotes/notes/allow_periodic_notifications_for_all_notification_types-ce399a32e5d0f4d3.yaml @@ -0,0 +1,3 @@ +--- +features: + - Allows periodic notifications to be used for all notification types.