diff --git a/TEMPLATE/libmatchers.jinja b/TEMPLATE/libmatchers.jinja index 10ff8bd1..142f59e1 100644 --- a/TEMPLATE/libmatchers.jinja +++ b/TEMPLATE/libmatchers.jinja @@ -161,28 +161,39 @@ ) %} {%- endif %} -{#- Add `merge:` option to `salt["config.get"]` if configured #} -{%- if cli not in ["ssh", "unknown"] and parsed.query_method == "config.get" and config_get_strategy %} -{%- set query_opts = { - "merge": config_get_strategy, - "delimiter": parsed.query_delimiter, - } %} +{#- Defaults for query #} +{%- set query_opts = { + "delimiter": parsed.query_delimiter, + } %} +{%- set query_opts_msg = ( + ", delimiter='" + ~ parsed.query_delimiter + ~ "'" + ) %} + +{#- Add `merge:` option to `salt["config.get"]` if config_get_strategy is provided #} +{%- if parsed.query_method == "config.get" and config_get_strategy %} +{%- do query_opts.update( + { + "merge": config_get_strategy + } + ) %} {%- set query_opts_msg = ( - ", delimiter='" - ~ parsed.query_delimiter + query_opts_msg ~ "', merge: strategy='" ~ config_get_strategy ~ "'" ) %} -{%- else %} -{%- if cli in ["ssh", "unknown"] %} -{%- do salt["log.warning"]( - log_prefix - ~ "the 'delimiter' and 'merge' options of 'config.get' are skipped when the salt command type is '" - ~ cli - ~ "'" - ) %} -{%- endif %} +{%- endif %} + +{#- Reset 'query_opts' and 'query_opts_msg' if 'cli' is 'ssh' or 'unknown' #} +{%- if cli in ["ssh", "unknown"] %} +{%- do salt["log.warning"]( + log_prefix + ~ "the 'delimiter' and 'merge' options of 'config.get' are skipped when the salt command type is '" + ~ cli + ~ "'" + ) %} {%- set query_opts = {} %} {%- set query_opts_msg = "" %} {%- endif %} diff --git a/bin/convert-formula.sh b/bin/convert-formula.sh index b740adfa..b70a4a1e 100755 --- a/bin/convert-formula.sh +++ b/bin/convert-formula.sh @@ -64,6 +64,8 @@ convert_formula() { git mv TEMPLATE "$NEW_NAME" + git mv test/salt/states/TEMPLATE "test/salt/states/$NEW_NAME" + # Replace TEMPLATE within sls and jinja files with py-safe formula name # due to python limitations on identifier names (no hyphen) # including when specifying jinja context variables diff --git a/kitchen.yml b/kitchen.yml index 981f5ff0..3340cfcd 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -19,6 +19,11 @@ provisioner: - .git pillars_from_directories: - test/salt/pillar + dependencies: + - name: parameters + path: ./test/salt/states + - name: TEMPLATE + path: ./test/salt/states platforms: ## SALT `tiamat` diff --git a/test/integration/default/files/_mapdata/almalinux-8.yaml b/test/integration/default/files/_mapdata/almalinux-8.yaml index 964d67f0..4f616d16 100644 --- a/test/integration/default/files/_mapdata/almalinux-8.yaml +++ b/test/integration/default/files/_mapdata/almalinux-8.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/amazonlinux-1.yaml b/test/integration/default/files/_mapdata/amazonlinux-1.yaml index 5e9a51da..b1d868da 100644 --- a/test/integration/default/files/_mapdata/amazonlinux-1.yaml +++ b/test/integration/default/files/_mapdata/amazonlinux-1.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: cronie rootgroup: root diff --git a/test/integration/default/files/_mapdata/amazonlinux-2.yaml b/test/integration/default/files/_mapdata/amazonlinux-2.yaml index 72cc0795..3c481678 100644 --- a/test/integration/default/files/_mapdata/amazonlinux-2.yaml +++ b/test/integration/default/files/_mapdata/amazonlinux-2.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/arch-base-latest.yaml b/test/integration/default/files/_mapdata/arch-base-latest.yaml index f229d778..db7c2e25 100644 --- a/test/integration/default/files/_mapdata/arch-base-latest.yaml +++ b/test/integration/default/files/_mapdata/arch-base-latest.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/centos-6.yaml b/test/integration/default/files/_mapdata/centos-6.yaml index e483d0de..f8198662 100644 --- a/test/integration/default/files/_mapdata/centos-6.yaml +++ b/test/integration/default/files/_mapdata/centos-6.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: cronie rootgroup: root diff --git a/test/integration/default/files/_mapdata/centos-7.yaml b/test/integration/default/files/_mapdata/centos-7.yaml index cbb0b4f1..c565cfbf 100644 --- a/test/integration/default/files/_mapdata/centos-7.yaml +++ b/test/integration/default/files/_mapdata/centos-7.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/centos-8.yaml b/test/integration/default/files/_mapdata/centos-8.yaml index b964150f..4a83976d 100644 --- a/test/integration/default/files/_mapdata/centos-8.yaml +++ b/test/integration/default/files/_mapdata/centos-8.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/debian-10.yaml b/test/integration/default/files/_mapdata/debian-10.yaml index cde07705..a0941dd6 100644 --- a/test/integration/default/files/_mapdata/debian-10.yaml +++ b/test/integration/default/files/_mapdata/debian-10.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/debian-11.yaml b/test/integration/default/files/_mapdata/debian-11.yaml index d30e2e9b..357f4cd2 100644 --- a/test/integration/default/files/_mapdata/debian-11.yaml +++ b/test/integration/default/files/_mapdata/debian-11.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/debian-9.yaml b/test/integration/default/files/_mapdata/debian-9.yaml index bf5aae93..1329cb58 100644 --- a/test/integration/default/files/_mapdata/debian-9.yaml +++ b/test/integration/default/files/_mapdata/debian-9.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/fedora-31.yaml b/test/integration/default/files/_mapdata/fedora-31.yaml index a36a2fad..2910fefc 100644 --- a/test/integration/default/files/_mapdata/fedora-31.yaml +++ b/test/integration/default/files/_mapdata/fedora-31.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/fedora-32.yaml b/test/integration/default/files/_mapdata/fedora-32.yaml index 4aac6c12..53c0d0bc 100644 --- a/test/integration/default/files/_mapdata/fedora-32.yaml +++ b/test/integration/default/files/_mapdata/fedora-32.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/fedora-33.yaml b/test/integration/default/files/_mapdata/fedora-33.yaml index 9508dd33..2732645a 100644 --- a/test/integration/default/files/_mapdata/fedora-33.yaml +++ b/test/integration/default/files/_mapdata/fedora-33.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/fedora-34.yaml b/test/integration/default/files/_mapdata/fedora-34.yaml index c5ef79b2..20a2cf06 100644 --- a/test/integration/default/files/_mapdata/fedora-34.yaml +++ b/test/integration/default/files/_mapdata/fedora-34.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/fedora-35.yaml b/test/integration/default/files/_mapdata/fedora-35.yaml index 6f0342a2..94f505fd 100644 --- a/test/integration/default/files/_mapdata/fedora-35.yaml +++ b/test/integration/default/files/_mapdata/fedora-35.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/fedora-36.yaml b/test/integration/default/files/_mapdata/fedora-36.yaml index 6e74490f..f8c32f70 100644 --- a/test/integration/default/files/_mapdata/fedora-36.yaml +++ b/test/integration/default/files/_mapdata/fedora-36.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml b/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml index 05e6ed59..b0b78a36 100644 --- a/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml +++ b/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: app-shells/bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml b/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml index 84b4fb9b..5781a727 100644 --- a/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml +++ b/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: app-shells/bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/opensuse-15.yaml b/test/integration/default/files/_mapdata/opensuse-15.yaml index 7a52c398..2d57391f 100644 --- a/test/integration/default/files/_mapdata/opensuse-15.yaml +++ b/test/integration/default/files/_mapdata/opensuse-15.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml b/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml index dffde67f..72ba311c 100644 --- a/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml +++ b/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/oraclelinux-7.yaml b/test/integration/default/files/_mapdata/oraclelinux-7.yaml index 4eae50df..e9b6cc72 100644 --- a/test/integration/default/files/_mapdata/oraclelinux-7.yaml +++ b/test/integration/default/files/_mapdata/oraclelinux-7.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/oraclelinux-8.yaml b/test/integration/default/files/_mapdata/oraclelinux-8.yaml index 40f09bbb..c5687a6b 100644 --- a/test/integration/default/files/_mapdata/oraclelinux-8.yaml +++ b/test/integration/default/files/_mapdata/oraclelinux-8.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/rockylinux-8.yaml b/test/integration/default/files/_mapdata/rockylinux-8.yaml index 1ca14ea8..99606085 100644 --- a/test/integration/default/files/_mapdata/rockylinux-8.yaml +++ b/test/integration/default/files/_mapdata/rockylinux-8.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/ubuntu-16.yaml b/test/integration/default/files/_mapdata/ubuntu-16.yaml index 83c9f8bf..1427a9fc 100644 --- a/test/integration/default/files/_mapdata/ubuntu-16.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-16.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/ubuntu-18.yaml b/test/integration/default/files/_mapdata/ubuntu-18.yaml index 86a231b5..82a63dd2 100644 --- a/test/integration/default/files/_mapdata/ubuntu-18.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-18.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/ubuntu-20.yaml b/test/integration/default/files/_mapdata/ubuntu-20.yaml index cc565823..165583d5 100644 --- a/test/integration/default/files/_mapdata/ubuntu-20.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-20.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/integration/default/files/_mapdata/ubuntu-22.yaml b/test/integration/default/files/_mapdata/ubuntu-22.yaml index 918ec51b..6a930467 100644 --- a/test/integration/default/files/_mapdata/ubuntu-22.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-22.yaml @@ -20,7 +20,10 @@ values: - C@TEMPLATE:lookup - C@TEMPLATE - Y:G@id + - Y:I:!@nested!pillar master: template-master + nested: + added_in_value: yaml pkg: name: bash rootgroup: root diff --git a/test/salt/pillar/default.sls b/test/salt/pillar/default.sls index d7f5ec54..cd41c07e 100644 --- a/test/salt/pillar/default.sls +++ b/test/salt/pillar/default.sls @@ -55,3 +55,7 @@ TEMPLATE: # Just for testing purposes winner: pillar added_in_pillar: pillar_value + nested: + added_in_value: pillar +nested: + pillar: nested_pillar_value diff --git a/test/salt/states/TEMPLATE/parameters/nested!pillar/nested_pillar_value.yaml b/test/salt/states/TEMPLATE/parameters/nested!pillar/nested_pillar_value.yaml new file mode 100644 index 00000000..2f36471a --- /dev/null +++ b/test/salt/states/TEMPLATE/parameters/nested!pillar/nested_pillar_value.yaml @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +# +# Used to test custom delimiters +--- +values: + nested: + added_in_value: yaml +... diff --git a/test/salt/states/parameters/map_jinja.yaml b/test/salt/states/parameters/map_jinja.yaml new file mode 100644 index 00000000..631567b2 --- /dev/null +++ b/test/salt/states/parameters/map_jinja.yaml @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +# +# Used to test custom delimiters +--- +merge_lists: true +values: + sources: + - Y:I:!@nested!pillar +...