Skip to content

Commit 5110716

Browse files
committed
fix(tofs): use source_files instead of files
* As discussed in the Slack/IRC/Matrix room from this point forward: - https://freenode.logbot.info/saltstack-formulas/20190308#c2046753
1 parent 3d9a24c commit 5110716

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

docs/TOFS_pattern.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ We can simplify the ``conf.sls`` with the new ``files_switch`` macro to use in t
316316
- template: jinja
317317
- source: {{ files_switch(
318318
salt['config.get'](
319-
tplroot ~ ':tofs:files:Configure NTP',
319+
tplroot ~ ':tofs:source_files:Configure NTP',
320320
['/etc/ntp.conf.jinja']
321321
)
322322
) }}
@@ -326,7 +326,7 @@ We can simplify the ``conf.sls`` with the new ``files_switch`` macro to use in t
326326
- pkg: Install NTP package
327327
328328
329-
* This uses ``config.get``, searching for ``nfs:tofs:files:Configure NTP`` to determine the list of template files to use.
329+
* This uses ``config.get``, searching for ``nfs:tofs:source_files:Configure NTP`` to determine the list of template files to use.
330330
* If this does not yield any results, the default of ``['/etc/ntp.conf.jinja']`` will be used.
331331

332332
In ``macros.jinja``, we define this new macro ``files_switch``.
@@ -417,16 +417,16 @@ Resulting in:
417417
...
418418
- salt://ntp/files/default_alt/etc/ntp.conf.jinja
419419
420-
Customise the list of template ``files``
421-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
420+
Customise the list of ``source_files``
421+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
422422

423-
The list of template ``files`` can be given:
423+
The list of ``source_files`` can be given:
424424

425425
.. code-block:: sls
426426
427427
ntp:
428428
tofs:
429-
files:
429+
source_files:
430430
Configure NTP:
431431
- '/etc/ntp.conf.jinja'
432432
- '/etc/ntp.conf_alt.jinja'

pillar.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ template:
3131
# dirs:
3232
# files: files_alt
3333
# default: default_alt
34-
# files:
34+
# source_files:
3535
# template-config-file-file-managed:
3636
# - 'example_alt.tmpl'
3737
# - 'example_alt.tmpl.jinja'

template/config/file.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ template-config-file-file-managed:
1515
- name: {{ template.config }}
1616
- source: {{ files_switch(
1717
salt['config.get'](
18-
tplroot ~ ':tofs:files:template-config-file-file-managed',
18+
tplroot ~ ':tofs:source_files:template-config-file-file-managed',
1919
['example.tmpl', 'example.tmpl.jinja']
2020
)
2121
) }}

template/macros.jinja

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{%- macro files_switch(files,
1+
{%- macro files_switch(source_files,
22
default_files_switch=['id', 'os_family'],
33
indent_width=6) %}
44
{#-
@@ -7,7 +7,7 @@
77
Files Switch (TOFS) pattern.
88
99
Params:
10-
* files: ordered list of files to look for
10+
* source_files: ordered list of files to look for
1111
* default_files_switch: if there's no pillar
1212
'<tplroot>:tofs:files_switch' this is the ordered list of grains to
1313
use as selector switch of the directories under
@@ -23,7 +23,7 @@
2323
- name: /etc/yyy/zzz.conf
2424
- source: {{ files_switch(
2525
salt['config.get'](
26-
tplroot ~ ':tofs:files:Deploy configuration',
26+
tplroot ~ ':tofs:source_files:Deploy configuration',
2727
['/etc/yyy/zzz.conf', '/etc/yyy/zzz.conf.jinja']
2828
)
2929
) }}
@@ -66,7 +66,7 @@
6666
{%- do fsl.append('') %}
6767
{%- endif %}
6868
{%- for fs in fsl %}
69-
{%- for file in files %}
69+
{%- for source_file in source_files %}
7070
{%- if fs %}
7171
{%- set fs_dir = salt['config.get'](fs, fs) %}
7272
{%- else %}
@@ -76,7 +76,7 @@
7676
path_prefix_inc_ext,
7777
files_dir,
7878
fs_dir,
79-
file.lstrip('/')
79+
source_file.lstrip('/')
8080
]) %}
8181
{{ url | indent(indent_width, true) }}
8282
{%- endfor %}

0 commit comments

Comments
 (0)