diff --git a/_macros/h.jinja b/_macros/h.jinja index 880899681..6c0f6f0af 100755 --- a/_macros/h.jinja +++ b/_macros/h.jinja @@ -3,23 +3,27 @@ dir='makina-states/files', after_macro=None, user='root', + target_prefix="", group='root', mode=750, makedirs=True, template='jinja') %} +{# retrocompatible kwargs access, either from direct in the template or from the "data" variable #} +{% set inline_jkwargs = salt['mc_utils.deepcopy'](kwargs) %} +{% do inline_jkwargs.pop('data', None) %} +{% do inline_jkwargs.update({'data': kwargs}) %} + {% for f, fdata in confs.items() %} {% set templated = fdata.get('template', template) %} {{prefix}}{{f}}: file.managed: - - name: "{{fdata.get('target', f)}}" + - name: "{{fdata.get('target', "{0}{1}".format(target_prefix, f))}}" - source: "{{fdata.get('source', 'salt://{0}{1}'.format(dir, f))}}" - mode: "{{fdata.get('mode', mode)}}" - user: "{{fdata.get('user', user)}}" - group: "{{fdata.get('group', group)}}" {% if kwargs %} - - context: - data: | - {{ kwargs | json }} + - context: {{inline_jkwargs | json }} {% endif %} {% if fdata.get('makedirs', makedirs) %} - makedirs: true diff --git a/files/projects/2/salt/fixperms.sls b/files/projects/2/salt/fixperms.sls index 812a7b1c7..3ad3eea6e 100755 --- a/files/projects/2/salt/fixperms.sls +++ b/files/projects/2/salt/fixperms.sls @@ -61,7 +61,7 @@ - user: root - mode: 744 - contents: | - {{cfg.data.fixperms_cron_periodicity}} root {{cfg.project_dir}}/global-reset-perms.sh + {{cfg.data.fixperms_cron_periodicity}} root {{cfg.project_dir}}/global-reset-perms.sh >/dev/null 2>&1 {%else%} file.absent: - name: /etc/cron.d/{{cfg.name.replace('.', '_')}}-fixperms