mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 06:51:10 +03:00
Merge pull request #3501 from beeankha/timeout_upgrade
Upgrade Old Email Timeout Notifications Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
commit
e3f10ebd65
@ -1,6 +1,7 @@
|
||||
# Copyright (c) 2016 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
from copy import deepcopy
|
||||
import logging
|
||||
|
||||
from django.db import models
|
||||
@ -122,7 +123,12 @@ class NotificationTemplate(CommonModelNameNotUnique):
|
||||
if not isinstance(recipients, list):
|
||||
recipients = [recipients]
|
||||
sender = self.notification_configuration.pop(self.notification_class.sender_parameter, None)
|
||||
backend_obj = self.notification_class(**self.notification_configuration)
|
||||
notification_configuration = deepcopy(self.notification_configuration)
|
||||
for field, params in self.notification_class.init_parameters.items():
|
||||
if field not in notification_configuration:
|
||||
if 'default' in params:
|
||||
notification_configuration[field] = params['default']
|
||||
backend_obj = self.notification_class(**notification_configuration)
|
||||
notification_obj = EmailMessage(subject, backend_obj.format_body(body), sender, recipients)
|
||||
with set_environ(**settings.AWX_TASK_ENV):
|
||||
return backend_obj.send_messages([notification_obj])
|
||||
|
@ -86,6 +86,10 @@ export default ['Rest', 'Wait',
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (data.notification_configuration.timeout === null ||
|
||||
!data.notification_configuration.timeout){
|
||||
$scope.timeout = 30;
|
||||
}
|
||||
if (data.notification_configuration[fld]) {
|
||||
$scope[fld] = data.notification_configuration[fld];
|
||||
master[fld] = data.notification_configuration[fld];
|
||||
@ -193,7 +197,11 @@ export default ['Rest', 'Wait',
|
||||
$scope[subFldName] = null;
|
||||
$scope.notification_template_form[subFldName].$setPristine();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if ($scope.timeout === null || !$scope.timeout) {
|
||||
$scope.timeout = 30;
|
||||
}
|
||||
else {
|
||||
$scope[fld] = null;
|
||||
$scope.notification_template_form[fld].$setPristine();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user