From 1e180d4277e34abc5dda19429dad956324e136f9 Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Nov 13 2017 21:01:25 +0000 Subject: Merge branch 'tampakrap_macro' into 'production' improve the macros.jinja to support also files that are not named init.sls See merge request infra/salt!91 --- diff --git a/pillar/macros.jinja b/pillar/macros.jinja index c234db6..75fe364 100644 --- a/pillar/macros.jinja +++ b/pillar/macros.jinja @@ -1,6 +1,6 @@ {%- macro include_optional(sls_file) %} {%- for root in opts['pillar_roots'][saltenv] -%} - {%- if salt['file.file_exists']('{0}/{1}/init.sls'.format(root, sls_file)) %} + {%- if salt['file.file_exists']('{0}/{1}/init.sls'.format(root, sls_file)) or salt['file.file_exists']('{0}/{1}.sls'.format(root, sls_file)) %} - {{ sls_file }} {% endif %} {%- endfor %} diff --git a/salt/macros.jinja b/salt/macros.jinja index 64e566b..e5ad3a7 100644 --- a/salt/macros.jinja +++ b/salt/macros.jinja @@ -1,6 +1,6 @@ {%- macro include_optional(sls_file) %} {%- for root in opts['file_roots'][saltenv] -%} - {%- if salt['file.file_exists']('{0}/{1}/init.sls'.format(root, sls_file)) %} + {%- if salt['file.file_exists']('{0}/{1}/init.sls'.format(root, sls_file)) or salt['file.file_exists']('{0}/{1}.sls'.format(root, sls_file)) %} - {{ sls_file }} {% endif %} {%- endfor %}