config_template does not respect yaml multiline as overrides
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack-Ansible |
Fix Released
|
Undecided
|
Georgina Shippey |
Bug Description
If you pass a multiline value as config overrides with yaml output it will split the multiline and export something completely wrong:
Given the following overrides:
test_overrides:
test: |
This is multiline on yaml
The newlines should be respected
but they are not
is it a bug?
With the following template:
---
cat1: cool
cat2: notsocool
And the following task:
- name: "test multiline merge"
config_template:
src: "test.j2"
dest: "test.yaml"
config_
config_type: yaml
delegate_to: localhost
Expected:
cat1: cool
cat2: notsocool
test: |
This is multiline on yaml
The newlines should be respected
but they are not
is it a bug?
But got:
cat1: cool
cat2: notsocool
test:
- This is multiline on yaml
- The newlines should be respected
- but they are not
- is it a bug?
This is probably due to the line https:/
The parsing of the values up to that point seems good to me.
Not sure how to solve it, maybe we should have a flag to *not* split the values? In the end this is changing a multiline into a list which could lead to unwanted consequences
Changed in openstack-ansible: | |
assignee: | nobody → Kevin Carter (kevin-carter) |
Changed in openstack-ansible: | |
assignee: | Kevin Carter (kevin-carter) → Georgina Shippey (gshippey) |
Changed in openstack-ansible: | |
status: | In Progress → Fix Released |
If you do the other way, having the multiline in the template instead of the overrides, it still doesn't output the correct multiline.
Given the following overrides:
test_overrides:
cat1: cool
cat2: notsocool
With the following template:
---
test: |
This is multiline on yaml
The newlines should be respected
but they are not
is it a bug?
And the following task:
- name: "test multiline merge" overrides: "{{ test_overrides }}"
config_template:
src: "test.j2"
dest: "test.yaml"
config_
config_type: yaml
delegate_to: localhost
Expected:
cat1: cool
cat2: notsocool
test: |
This is multiline on yaml
The newlines should be respected
but they are not
is it a bug?
But got:
Expected:
cat1: cool
cat2: notsocool
test: |-
This is multiline on yaml
The newlines should be respected
but they are not
is it a bug?
The subtle difference is that we are adding the "-" to the multiline for some reason which we should not do as it may change what is expected from the output.
Sure this is a minor thing as it only stripes the last line, but something to take into account. We dont want to change the output for no good reason :D