* Automated using https://github.com/myii/ssf-formula/pull/418tags/v3.0.3
{#- Load YAML file matching the grain/pillar/... #} | {#- Load YAML file matching the grain/pillar/... #} | ||||
{#- Fallback to use the source name as a direct filename #} | {#- 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 #} | {#- Mangle `matcher.value` to use it as literal path #} | ||||
{%- set query_parts = matcher.query.split("/") %} | {%- set query_parts = matcher.query.split("/") %} | ||||
{%- set yaml_dirname = query_parts[0:-1] | join("/") %} | {%- set yaml_dirname = query_parts[0:-1] | join("/") %} | ||||
{#- Some configuration return list #} | {#- Some configuration return list #} | ||||
{%- if yaml_names is string %} | {%- if yaml_names is string %} | ||||
{%- set yaml_names = [yaml_names] %} | {%- 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 %} | {%- endif %} | ||||
{#- Try to load a `.yaml.jinja` file for each `.yaml` file #} | {#- Try to load a `.yaml.jinja` file for each `.yaml` file #} |
} %} | } %} | ||||
{#- When no part before `@` is provided: #} | {#- When no part before `@` is provided: #} | ||||
{#- - define a filename path, noted `F` #} | |||||
{#- - define a YAML file path, noted `Y` #} | |||||
{#- - use `salt["config.get"]`, noted `C` #} | {#- - use `salt["config.get"]`, noted `C` #} | ||||
{#- - use colon `:` delimiter for querying #} | {#- - use colon `:` delimiter for querying #} | ||||
{%- set _defaults = { | {%- set _defaults = { | ||||
"type": "F", | |||||
"type": "Y", | |||||
"query_type": "C", | "query_type": "C", | ||||
"query_delimiter": ":" | "query_delimiter": ":" | ||||
} %} | } %} | ||||
) %} | ) %} | ||||
{#- matcher format is `[<TYPE>[:<OPTION>[:DELIMITER]]@]<KEY>` #} | {#- matcher format is `[<TYPE>[:<OPTION>[:DELIMITER]]@]<KEY>` #} | ||||
{#- each matcher has a type: #} | {#- each matcher has a type: #} | ||||
{#- - `F` to build a file name (the default when no type is set) #} | |||||
{#- - `Y` to build a YAML file name (the default when no type is set) #} | |||||
{#- - `C` to lookup values with `config.get` #} | {#- - `C` to lookup values with `config.get` #} | ||||
{#- - `G` to lookup values with `grains.get` #} | {#- - `G` to lookup values with `grains.get` #} | ||||
{#- - `I` to lookup values with `pillar.get` #} | {#- - `I` to lookup values with `pillar.get` #} | ||||
{#- The `FILE` type option can define query type to build the file name: #} | |||||
{#- The `YAML` type option can define query type to build the file name: #} | |||||
{#- - `C` for query with `config.get` (the default when to query type is set) #} | {#- - `C` for query with `config.get` (the default when to query type is set) #} | ||||
{#- - `G` for query with `grains.get` #} | {#- - `G` for query with `grains.get` #} | ||||
{#- - `I` for query with `pillar.get` #} | {#- - `I` for query with `pillar.get` #} |
# -*- coding: utf-8 -*- | |||||
# vim: ft=jinja | |||||
{#- -*- coding: utf-8 -*- #} | |||||
{#- vim: ft=jinja #} | |||||
{#- Get the relevant values from the `opts` dict #} | {#- Get the relevant values from the `opts` dict #} | ||||
{%- set opts_cli = opts.get('__cli', '') %} | {%- set opts_cli = opts.get('__cli', '') %} |