1769158a0e
Added a flag called yml_multilines which when used will not split on lines that have a newline UNLESS they have a comma. Change-Id: I90364403e215a67b320dfc7e67a85d47c774e634 Partial-Bug: #1819974
373 lines
8.7 KiB
YAML
373 lines
8.7 KiB
YAML
---
|
|
# Copyright 2018, Rackspace US
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Setup the host
|
|
- include: common/test-prepare-keys.yml
|
|
|
|
- include: common/test-prepare-host.yml
|
|
|
|
# Temporary work around for issue with lxc_host where on second run after
|
|
# all iptables rules have been removed, the lxc_host role is not checking
|
|
# that the rules are defined and adding them back in if they are not.
|
|
- name: Add iptables rules back in
|
|
hosts: localhost
|
|
connection: local
|
|
gather_facts: yes
|
|
become: yes
|
|
|
|
vars:
|
|
do_not_fail_lint: true
|
|
|
|
tasks:
|
|
- name: Ensure lxc iptables rules
|
|
command: /usr/local/bin/lxc-system-manage iptables-create
|
|
when: do_not_fail_lint
|
|
|
|
- include: common/test-prepare-containers.yml
|
|
|
|
- name: Test config_template
|
|
hosts: localhost
|
|
connection: local
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
- name: Read expected test_extend.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_extend.yml.expected"
|
|
register: extend_file_expected
|
|
|
|
- name: Read expected test_no_extend.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_no_extend.yml.expected"
|
|
register: no_extend_file_expected
|
|
|
|
- name: Read expected test_content_no_overrides.json
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_content_no_overrides.json.expected"
|
|
register: content_no_overrides_file_expected
|
|
|
|
- name: Read expected test_multiline_strs.yml
|
|
slurp:
|
|
src: "{{ playbook_dir }}/files/test_multiline_strs.yml.expected"
|
|
register: multiline_strs_file_expected
|
|
|
|
- import_tasks: test-common-tasks.yml
|
|
|
|
- import_tasks: test-common-tasks.yml
|
|
delegate_to: container1
|
|
|
|
handlers:
|
|
- name: test_ini check diff
|
|
assert:
|
|
that:
|
|
- test_ini.diff[0].prepared|from_json == diff_ini
|
|
|
|
- name: test_with_content_ini check diff
|
|
assert:
|
|
that:
|
|
- test_with_content_ini.diff[0].prepared|from_json == diff_ini
|
|
|
|
- name: test_extend_yml check diff
|
|
assert:
|
|
that:
|
|
- test_extend_yml.diff[0].prepared|from_json == diff_extend_yml
|
|
|
|
- name: test_no_extend_yml check diff
|
|
assert:
|
|
that:
|
|
- test_no_extend_yml.diff[0].prepared|from_json == diff_no_extend_yml
|
|
|
|
- name: test_hostvars_yml check diff
|
|
assert:
|
|
that:
|
|
- test_hostvars_yml.diff[0].prepared|from_yaml == diff_hostvars_yml
|
|
|
|
- name: test_content_no_overrides_json check diff
|
|
assert:
|
|
that:
|
|
- test_content_no_overrides_json.diff[0].prepared|from_json == diff_content_no_overrides_json
|
|
|
|
- name: test_ignore_none_type_ini check diff
|
|
assert:
|
|
that:
|
|
- test_ignore_none_type_ini.diff[0].prepared|from_json == diff_ignore_none_type_ini
|
|
|
|
- name: test_with_comments_ini check diff
|
|
tags: test
|
|
assert:
|
|
that:
|
|
- test_with_comments_ini.diff[0].prepared|from_json == diff_with_comments_ini
|
|
|
|
- name: test_diff_ini check diff
|
|
tags: test
|
|
assert:
|
|
that:
|
|
- test_diff_ini.diff[0].prepared|from_json == diff_diff_ini
|
|
|
|
- name: test_diff_remove_ini check diff
|
|
tags: test
|
|
assert:
|
|
that:
|
|
- test_diff_remove_ini.diff[0].prepared|from_json == diff_diff_remove_ini
|
|
|
|
vars:
|
|
test_config_ini_overrides:
|
|
DEFAULT:
|
|
new_key: "new_value"
|
|
foo:
|
|
baz: "bar"
|
|
section1:
|
|
key1: "String1"
|
|
key2: "string2"
|
|
key3: "string3"
|
|
key4: "string4"
|
|
key5: "string5"
|
|
key6: "string6"
|
|
key7: 1
|
|
key8: 2
|
|
key9: 3
|
|
key10: 10
|
|
key11: 11
|
|
section2:
|
|
key1: "value1"
|
|
section3:
|
|
key1: "value1"
|
|
section4:
|
|
key1: "value1"
|
|
section5:
|
|
key1: "value1"
|
|
section6:
|
|
key1: "value1"
|
|
section7:
|
|
key1: "value1"
|
|
section8:
|
|
key1: 1
|
|
section9:
|
|
key1: 1
|
|
section10:
|
|
key1: 1
|
|
section11:
|
|
key1: 1
|
|
test_config_yml_overrides:
|
|
list_one:
|
|
- four
|
|
- 4
|
|
test_config_yml_hostvars_overrides:
|
|
test_hostvar: "{{ ansible_default_ipv4.address }}"
|
|
test_multiline_strs_yml_overrides:
|
|
new_multiline_str: |
|
|
This should not
|
|
be a list
|
|
test_default_section_overrides:
|
|
global:
|
|
test2: 2
|
|
section1:
|
|
setting2: 2
|
|
test_diff_overrides:
|
|
section1:
|
|
baz: "hotel"
|
|
section3:
|
|
alfa: "bravo"
|
|
diff_with_comments_ini:
|
|
added:
|
|
DEFAULT:
|
|
new_key: "new_value"
|
|
test_hosts: "\n+_unicode\n1\nstring"
|
|
bar: {}
|
|
foo:
|
|
baz: "bar"
|
|
section1:
|
|
key1: "String1"
|
|
key10: "10"
|
|
key11: "11"
|
|
key2: "string2"
|
|
key3: "string3"
|
|
key4: "string4"
|
|
key5: "string5"
|
|
key6: "string6"
|
|
key7: "1"
|
|
key8: "2"
|
|
key9: "3"
|
|
section10:
|
|
key1: "1"
|
|
section11:
|
|
key1: "1"
|
|
section2:
|
|
key1: "value1"
|
|
section3:
|
|
key1: "value1"
|
|
section4:
|
|
key1: "value1"
|
|
section5:
|
|
key1: "value1"
|
|
section6:
|
|
key1: "value1"
|
|
section7:
|
|
key1: "value1"
|
|
section8:
|
|
key1: "1"
|
|
section9:
|
|
key1: "1"
|
|
changed: {}
|
|
removed: {}
|
|
diff_ini:
|
|
added:
|
|
DEFAULT:
|
|
new_key: "new_value"
|
|
bar: {}
|
|
foo:
|
|
baz: "bar"
|
|
section1:
|
|
key1: "String1"
|
|
key10: "10"
|
|
key11: "11"
|
|
key2: "string2"
|
|
key3: "string3"
|
|
key4: "string4"
|
|
key5: "string5"
|
|
key6: "string6"
|
|
key7: "1"
|
|
key8: "2"
|
|
key9: "3"
|
|
section10:
|
|
key1: "1"
|
|
section11:
|
|
key1: "1"
|
|
section2:
|
|
key1: "value1"
|
|
section3:
|
|
key1: "value1"
|
|
section4:
|
|
key1: "value1"
|
|
section5:
|
|
key1: "value1"
|
|
section6:
|
|
key1: "value1"
|
|
section7:
|
|
key1: "value1"
|
|
section8:
|
|
key1: "1"
|
|
section9:
|
|
key1: "1"
|
|
changed: {}
|
|
removed: {}
|
|
diff_extend_yml:
|
|
added:
|
|
list_one:
|
|
- "one"
|
|
- "two"
|
|
- "three"
|
|
- "four"
|
|
- 4
|
|
list_two:
|
|
- "one"
|
|
- "two"
|
|
changed: {}
|
|
removed: {}
|
|
diff_no_extend_yml:
|
|
added:
|
|
list_one:
|
|
- "four"
|
|
- 4
|
|
list_two:
|
|
- "one"
|
|
- "two"
|
|
changed: {}
|
|
removed: {}
|
|
diff_hostvars_yml:
|
|
added:
|
|
list_one:
|
|
- "one"
|
|
- "two"
|
|
- "three"
|
|
list_two:
|
|
- "one"
|
|
- "two"
|
|
test_hostvar: "{{ ansible_default_ipv4.address }}"
|
|
changed: {}
|
|
removed: {}
|
|
diff_ignore_none_type_ini:
|
|
added:
|
|
DEFAULT:
|
|
new_key: "new_value"
|
|
alfa:
|
|
bravo: "charlie"
|
|
delta: "echo"
|
|
foo:
|
|
baz: "bar"
|
|
foxtrot:
|
|
golf: "hotel"
|
|
india: null
|
|
juliett kilo: null
|
|
lima: "mike"
|
|
section1:
|
|
key1: "String1"
|
|
key10: "10"
|
|
key11: "11"
|
|
key2: "string2"
|
|
key3: "string3"
|
|
key4: "string4"
|
|
key5: "string5"
|
|
key6: "string6"
|
|
key7: "1"
|
|
key8: "2"
|
|
key9: "3"
|
|
section10:
|
|
key1: "1"
|
|
section11:
|
|
key1: "1"
|
|
section2:
|
|
key1: "value1"
|
|
section3:
|
|
key1: "value1"
|
|
section4:
|
|
key1: "value1"
|
|
section5:
|
|
key1: "value1"
|
|
section6:
|
|
key1: "value1"
|
|
section7:
|
|
key1: "value1"
|
|
section8:
|
|
key1: "1"
|
|
section9:
|
|
key1: "1"
|
|
changed: {}
|
|
removed: {}
|
|
diff_content_no_overrides_json:
|
|
added:
|
|
alfa: "bravo"
|
|
charlie: "echo"
|
|
foxtrot:
|
|
golf: "hotel"
|
|
changed: {}
|
|
removed: {}
|
|
diff_diff_ini:
|
|
added:
|
|
section3:
|
|
alfa: "bravo"
|
|
changed:
|
|
section1:
|
|
baz:
|
|
current_val: "baz"
|
|
new_val: "hotel"
|
|
removed: {}
|
|
diff_diff_remove_ini:
|
|
added: {}
|
|
changed: {}
|
|
removed:
|
|
section2:
|
|
foo: "bar"
|