mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-05 21:54:22 -07:00
* Prevent yaml callback from modifying PyYAML.
* Fix changelog fragment.
* Update changelogs/fragments/3478-yaml-callback.yml
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
(cherry picked from commit 5895e50185
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
59af80235b
commit
2917389779
3 changed files with 63 additions and 24 deletions
|
@ -58,3 +58,40 @@
|
|||
"PLAY RECAP *********************************************************************",
|
||||
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
|
||||
]
|
||||
- name: Test to_yaml
|
||||
environment:
|
||||
ANSIBLE_NOCOLOR: 'true'
|
||||
ANSIBLE_FORCE_COLOR: 'false'
|
||||
ANSIBLE_STDOUT_CALLBACK: community.general.yaml
|
||||
playbook: |
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
data: |
|
||||
line 1
|
||||
line 2
|
||||
line 3
|
||||
tasks:
|
||||
- name: Test to_yaml
|
||||
debug:
|
||||
msg: "{{ '{{' }}'{{ '{{' }}'{{ '}}' }} data | to_yaml {{ '{{' }}'{{ '}}' }}'{{ '}}' }}"
|
||||
# The above should be: msg: "{{ data | to_yaml }}"
|
||||
# Unfortunately, the way Ansible handles templating, we need to do some funny 'escaping' tricks...
|
||||
expected_output: [
|
||||
"",
|
||||
"PLAY [testhost] ****************************************************************",
|
||||
"",
|
||||
"TASK [Test to_yaml] ************************************************************",
|
||||
"ok: [testhost] => ",
|
||||
" msg: |-",
|
||||
" 'line 1",
|
||||
" ",
|
||||
" line 2",
|
||||
" ",
|
||||
" line 3",
|
||||
" ",
|
||||
" '",
|
||||
"",
|
||||
"PLAY RECAP *********************************************************************",
|
||||
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue