mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 11:41:08 -03:30
Notification serializers, views, and tasks
* Implement concrete Notification model for notification runs * Implement NotificationTemplate and Notification serializers and views * Implement ancillary views * Implement NotificationTemplate trigger m2m fields on all job templates via a fields mixin * Link NotificationTemplates with an org * Link notifications with the activity stream * Implement Notification celery tasks * Extend Backend field parameters to identify sender and receiver as parameters needed by the message and not the backend itself * Updates to backends to better fit the django email backend model as it relates to Messages * Implement success job chain task + notifications * Implement notifications in error job chain task
This commit is contained in:
@@ -23,6 +23,7 @@ from awx.main.managers import HostManager
|
||||
from awx.main.models.base import * # noqa
|
||||
from awx.main.models.jobs import Job
|
||||
from awx.main.models.unified_jobs import * # noqa
|
||||
from awx.main.models.notifications import NotificationTemplate
|
||||
from awx.main.utils import ignore_inventory_computed_fields, _inventory_updates
|
||||
|
||||
__all__ = ['Inventory', 'Host', 'Group', 'InventorySource', 'InventoryUpdate', 'CustomInventoryScript']
|
||||
@@ -1180,6 +1181,15 @@ class InventorySource(UnifiedJobTemplate, InventorySourceOptions):
|
||||
return True
|
||||
return False
|
||||
|
||||
@property
|
||||
def notifiers(self):
|
||||
# Return all notifiers defined on the Project, and on the Organization for each trigger type
|
||||
base_notifiers = NotificationTemplate.objects.filter(active=True)
|
||||
error_notifiers = list(base_notifiers.filter(organization_notifications_for_errors__in=self))
|
||||
success_notifiers = list(base_notifiers.filter(organization_notifications_for_success__in=self))
|
||||
any_notifiers = list(base_notifiers.filter(organization_notifications_for_any__in=self))
|
||||
return dict(error=error_notifiers, success=success_notifiers, any=any_notifiers)
|
||||
|
||||
def clean_source(self):
|
||||
source = self.source
|
||||
if source and self.group:
|
||||
|
||||
Reference in New Issue
Block a user