File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 181181{#- Load YAML file matching the grain/pillar/... #}
182182{#- Fallback to use the source name as a direct filename #}
183183
184- {% - if matcher .value | length == 0 %}
184+ {% - if matcher .value is sequence and matcher . value | length == 0 %}
185185{#- Mangle `matcher.value` to use it as literal path #}
186186{% - set query_parts = matcher .query .split ("/" ) %}
187187{% - set yaml_dirname = query_parts [0:-1] | join ("/" ) %}
194194{#- Some configuration return list #}
195195{% - if yaml_names is string %}
196196{% - set yaml_names = [yaml_names ] %}
197+ {% - elif yaml_names is sequence %}
198+ {#- Convert to strings if it's a sequence of numbers #}
199+ {% - set yaml_names = yaml_names | map ("string" ) | list %}
200+ {% - else %}
201+ {% - set yaml_names = [yaml_names | string ] %}
197202{% - endif %}
198203
199204{#- Try to load a `.yaml.jinja` file for each `.yaml` file #}
Original file line number Diff line number Diff line change 1212 } %}
1313
1414{#- When no part before `@` is provided: #}
15- {#- - define a filename path, noted `F ` #}
15+ {#- - define a YAML file path, noted `Y ` #}
1616{#- - use `salt["config.get"]`, noted `C` #}
1717{#- - use colon `:` delimiter for querying #}
1818{% - set _defaults = {
19- "type" : "F " ,
19+ "type" : "Y " ,
2020 "query_type" : "C" ,
2121 "query_delimiter" : ":"
2222 } %}
2828 ) %}
2929{#- matcher format is `[<TYPE>[:<OPTION>[:DELIMITER]]@]<KEY>` #}
3030{#- each matcher has a type: #}
31- {#- - `F ` to build a file name (the default when no type is set) #}
31+ {#- - `Y ` to build a YAML file name (the default when no type is set) #}
3232{#- - `C` to lookup values with `config.get` #}
3333{#- - `G` to lookup values with `grains.get` #}
3434{#- - `I` to lookup values with `pillar.get` #}
35- {#- The `FILE ` type option can define query type to build the file name: #}
35+ {#- The `YAML ` type option can define query type to build the file name: #}
3636{#- - `C` for query with `config.get` (the default when to query type is set) #}
3737{#- - `G` for query with `grains.get` #}
3838{#- - `I` for query with `pillar.get` #}
Original file line number Diff line number Diff line change 1- # -*- coding: utf-8 -*-
2- # vim: ft=jinja
1+ {#- -*- coding: utf-8 -*- #}
2+ {#- vim: ft=jinja #}
33
44{#- Get the relevant values from the `opts` dict #}
55{% - set opts_cli = opts .get ('__cli' , '' ) %}
You can’t perform that action at this time.
0 commit comments