Skip to content

Commit

Permalink
fix(tofs): prepend the config-based source_files to the default
Browse files Browse the repository at this point in the history
* saltstack-formulas/nginx-formula#247 (comment)
  - The main issue is that the `nginx-formula` has dynamic values being
    used by as the default `source_files` -- there is no way to provide
    this from the pillar/config in a sensible fashion
  - Prepending to this default (rather than overriding it) resolves this
    problem entirely, without adding excessive entries to the `source`
* Closes saltstack-formulas#151
  • Loading branch information
myii committed Jul 23, 2019
1 parent 57d0b85 commit b778901
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions template/libtofs.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Params:
* source_files: ordered list of files to look for
* lookup: key under '<tplroot>:tofs:source_files' to override
* lookup: key under '<tplroot>:tofs:source_files' to prepend to the
list of source files
* default_files_switch: if there's no config (e.g. pillar)
'<tplroot>:tofs:files_switch' this is the ordered list of grains to
Expand Down Expand Up @@ -55,14 +55,13 @@
tplroot ~ ':tofs:files_switch',
default_files_switch
) %}
{#- Lookup source_files (v2), files (v1), or fallback to source_files parameter #}
{#- Lookup source_files (v2), files (v1), or fallback to an empty list #}
{%- set src_files = salt['config.get'](
tplroot ~ ':tofs:source_files:' ~ lookup,
salt['config.get'](
tplroot ~ ':tofs:files:' ~ lookup,
source_files
)
salt['config.get'](tplroot ~ ':tofs:files:' ~ lookup, [])
) %}
{#- Append the default source_files #}
{%- set src_files = src_files + source_files %}
{#- Only add to [''] when supporting older TOFS implementations #}
{%- set path_prefix_exts = [''] %}
{%- if v1_path_prefix != '' %}
Expand Down

0 comments on commit b778901

Please sign in to comment.