From bb3a7ea0b208eeb2b6472ca9cb011935032c0356 Mon Sep 17 00:00:00 2001 From: Stanislav Asunkin <1353637+stasjok@users.noreply.github.com> Date: Tue, 15 Feb 2022 18:35:15 +0300 Subject: [PATCH] fix(libmapstack): allow mapping by booleans and numbers --- TEMPLATE/libmapstack.jinja | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/TEMPLATE/libmapstack.jinja b/TEMPLATE/libmapstack.jinja index 7756f0fb..8f54ef37 100644 --- a/TEMPLATE/libmapstack.jinja +++ b/TEMPLATE/libmapstack.jinja @@ -181,7 +181,7 @@ {#- Load YAML file matching the grain/pillar/... #} {#- Fallback to use the source name as a direct filename #} -{%- if matcher.value | length == 0 %} +{%- if matcher.value is sequence and matcher.value | length == 0 %} {#- Mangle `matcher.value` to use it as literal path #} {%- set query_parts = matcher.query.split("/") %} {%- set yaml_dirname = query_parts[0:-1] | join("/") %} @@ -194,6 +194,11 @@ {#- Some configuration return list #} {%- if yaml_names is string %} {%- set yaml_names = [yaml_names] %} +{%- elif yaml_names is sequence %} +{#- Convert to strings if it's a sequence of numbers #} +{%- set yaml_names = yaml_names | map("string") | list %} +{%- else %} +{%- set yaml_names = [yaml_names | string] %} {%- endif %} {#- Try to load a `.yaml.jinja` file for each `.yaml` file #}