Skip to content

Commit

Permalink
feat(maj.jinja): authorise literal file path in “map.jinja:sources”
Browse files Browse the repository at this point in the history
This mimic the behavior of “libtofs.jinja”.
  • Loading branch information
baby-gnu committed Feb 15, 2020
1 parent f06238d commit 76a7029
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion TEMPLATE/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

{%- for map_source in map_sources %}
{# Lookup the grain/pillar/... #}
{%- set map_values = salt['config.get'](map_source, []) %}
{# Fallback to use the source name as a direct filename #}
{%- set map_values = salt['config.get'](map_source, [map_source]) %}
{%- if map_values is string %}
{%- set map_values = [map_values] %}
{%- endif %}
Expand Down
8 changes: 7 additions & 1 deletion TEMPLATE/parameters/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ subcomponent:
# Just here for testing
added_in_defaults: defaults_value
winner: defaults
# Configure map.jinja to load formula parameters values
# Configure map.jinja to load formula parameters values and merge them
# in the order from most generic (first) to most specific (last).
# Each source can define the merging `strategy` which default to the
# `smart` strategy of `salt.slsutil.merge`.
# Note: Any value not evaluated by `config.get` will be used literally.
# This can be used to set custom paths, as many levels deep as required.
map.jinja:
sources:
- osarch
- os_family
- os
- osfinger
- roles
- any/path/can/be/used/here.yaml

0 comments on commit 76a7029

Please sign in to comment.