Skip to content

Commit 923b459

Browse files
committed
refactor(macros): use tplroot instead of topdir to match tpldata
1 parent 3f89c12 commit 923b459

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

template/macros.jinja

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
- salt://xxx/files/default/etc/yyy/zzz.conf.jinja
4343
- template: jinja
4444
#}
45-
{#- Get the `topdir` from `tpldir` #}
46-
{%- set topdir = tpldir.split('/')[0] %}
47-
{%- set path_prefix = salt['config.get'](topdir ~ ':tofs:path_prefix', topdir) %}
48-
{%- set files_dir = salt['config.get'](topdir ~ ':tofs:dirs:files', 'files') %}
45+
{#- Get the `tplroot` from `tpldir` #}
46+
{%- set tplroot = tpldir.split('/')[0] %}
47+
{%- set path_prefix = salt['config.get'](tplroot ~ ':tofs:path_prefix', tplroot) %}
48+
{%- set files_dir = salt['config.get'](tplroot ~ ':tofs:dirs:files', 'files') %}
4949
{%- set files_switch_list = salt['config.get'](
50-
topdir ~ ':tofs:files_switch',
50+
tplroot ~ ':tofs:files_switch',
5151
default_files_switch
5252
) %}
5353
{#- Only add to [''] when supporting older TOFS implementations #}
@@ -56,7 +56,7 @@
5656
{#- For older TOFS implementation, use `files_switch` from the pillar #}
5757
{#- Use the default, new method otherwise #}
5858
{%- set fsl = salt['pillar.get'](
59-
topdir ~ path_prefix_ext|replace('/', ':') ~ ':files_switch',
59+
tplroot ~ path_prefix_ext|replace('/', ':') ~ ':files_switch',
6060
files_switch_list
6161
) %}
6262
{#- Append an empty value to evaluate as `default` in the loop below #}
@@ -68,7 +68,7 @@
6868
{%- if fs %}
6969
{%- set fs_dir = salt['config.get'](fs, fs) %}
7070
{%- else %}
71-
{%- set fs_dir = salt['config.get'](topdir ~ ':tofs:dirs:default', 'default') %}
71+
{%- set fs_dir = salt['config.get'](tplroot ~ ':tofs:dirs:default', 'default') %}
7272
{%- endif %}
7373
{%- set url = '- salt://' ~ '/'.join([
7474
path_prefix_inc_ext,

0 commit comments

Comments
 (0)