mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 14:09:28 -02:30
Merge pull request #12306 from ansible/10961-webhook-notification-does-not-allow-for-use-of-jinja-statements
Duplication of PR of Jinga 2 Rendering
This commit is contained in:
@@ -4478,7 +4478,10 @@ class NotificationTemplateSerializer(BaseSerializer):
|
|||||||
body = messages[event].get('body', {})
|
body = messages[event].get('body', {})
|
||||||
if body:
|
if body:
|
||||||
try:
|
try:
|
||||||
potential_body = json.loads(body)
|
rendered_body = (
|
||||||
|
sandbox.ImmutableSandboxedEnvironment(undefined=DescriptiveUndefined).from_string(body).render(JobNotificationMixin.context_stub())
|
||||||
|
)
|
||||||
|
potential_body = json.loads(rendered_body)
|
||||||
if not isinstance(potential_body, dict):
|
if not isinstance(potential_body, dict):
|
||||||
error_list.append(
|
error_list.append(
|
||||||
_("Webhook body for '{}' should be a json dictionary. Found type '{}'.".format(event, type(potential_body).__name__))
|
_("Webhook body for '{}' should be a json dictionary. Found type '{}'.".format(event, type(potential_body).__name__))
|
||||||
|
|||||||
Reference in New Issue
Block a user