-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
I’m using a notification template in Ansible Automation Platform (AAP) and Success message body looks like this:
{{ job_friendly_name }} #{{ job.id }} '{{ job.name }}' {{ job.status }}
Start: {{ job.started }}
End: {{ job.finished }}
Duration: {{ job.elapsed }} seconds
view details at {{ url }}
After using the filetree_create role, the generated YAML looks like provided in Actual Behavior.
However, it should look like provided in Desired Behaviour (only one !unsafe before the whole block):
So it seems the role is incorrectly inserting additional !unsafe tags inside the Jinja expressions.
This breaks the formatting of the template and causes unexpected rendering behavior in AAP.
Issue Type
- Bug Report
Ansible, Collection, Controller details
It's happening on AAP 2.4 but the code of collection is the same as for AAP 2.5.
messages:
{{ current_notification_templates_asset_value.messages | to_nice_yaml(indent=2, sort_keys=false) | indent(width=6, first=True) | regex_replace('(^[^:]*): (.*){([{%])', '\\g<1>: !unsafe \\g<2>{\\g<3>', multiline=True) | replace("body: '", "body: !unsafe \'") }}
OS / ENVIRONMENT
N/A
Desired Behavior
success:
body: !unsafe '{{ job_friendly_name }} #{{ job.id }} ''{{ job.name }}'' {{ job.status }}
Start: {{ job.started }}
End: {{ job.finished }}
Duration: {{ job.elapsed }} seconds
view details at {{ url }}'
Actual Behavior
success:
body: !unsafe '{{ job_friendly_name }} #{{ job.id }} ''{{ job.name }}'' {{ job.status }}
Start: !unsafe {{ job.started }}
End: !unsafe {{ job.finished }}
Duration: !unsafe {{ job.elapsed }} seconds
view details at {{ url }}'
STEPS TO REPRODUCE
- Paste this code into notification template field Success message body
{{ job_friendly_name }} #{{ job.id }} '{{ job.name }}' {{ job.status }}
Start: {{ job.started }}
End: {{ job.finished }}
Duration: {{ job.elapsed }} seconds
view details at {{ url }}
- Run filetree_create to create export
- Run filetree_read with exported file
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working