From da7e69283ff72425e0b7746f114a0ed46246d861 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Thu, 21 Mar 2019 11:42:14 +0100 Subject: [PATCH] =?UTF-8?q?refactor(tofs):=20move=20=E2=80=9Cfiles=5Fswitc?= =?UTF-8?q?h=E2=80=9D=20macro=20to=20=E2=80=9Clibtofs.jinja=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BREAKING CHANGE: every formula writer will need to change the import to use this new version. * template/libtofs.jinja: provides the “files_switch” macro. * docs/TOFS_pattern.rst: update documentation to use the new path. * template/config/clean.sls: change import from “macros.jinja” to “libtofs.jinja”. * template/config/file.sls: ditoo. --- docs/TOFS_pattern.rst | 8 ++++---- template/config/clean.sls | 2 +- template/config/file.sls | 2 +- template/{macros.jinja => libtofs.jinja} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename template/{macros.jinja => libtofs.jinja} (100%) diff --git a/docs/TOFS_pattern.rst b/docs/TOFS_pattern.rst index 952e77c7..e6c30132 100644 --- a/docs/TOFS_pattern.rst +++ b/docs/TOFS_pattern.rst @@ -308,7 +308,7 @@ We can simplify the ``conf.sls`` with the new ``files_switch`` macro to use in t {%- set tplroot = tpldir.split('/')[0] %} {%- from 'ntp/map.jinja' import ntp with context %} - {%- from 'ntp/macros.jinja' import files_switch %} + {%- from 'ntp/libtofs.jinja' import files_switch %} Configure NTP: file.managed: @@ -327,10 +327,10 @@ We can simplify the ``conf.sls`` with the new ``files_switch`` macro to use in t * This uses ``config.get``, searching for ``ntp:tofs:source_files:Configure NTP`` to determine the list of template files to use. * If this does not yield any results, the default of ``['/etc/ntp.conf.jinja']`` will be used. -In ``macros.jinja``, we define this new macro ``files_switch``. +In ``libtofs.jinja``, we define this new macro ``files_switch``. -.. literalinclude:: ../template/macros.jinja - :caption: /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/macros.jinja +.. literalinclude:: ../template/libtofs.jinja + :caption: /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/libtofs.jinja :language: jinja How to customise the ``source`` further diff --git a/template/config/clean.sls b/template/config/clean.sls index 5b3ee11d..d442f9d9 100644 --- a/template/config/clean.sls +++ b/template/config/clean.sls @@ -5,7 +5,7 @@ {%- set tplroot = tpldir.split('/')[0] %} {%- set sls_service_clean = tplroot ~ '.service.clean' %} {%- from tplroot ~ "/map.jinja" import template with context %} -{%- from tplroot ~ "/macros.jinja" import files_switch with context %} +{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} include: - {{ sls_service_clean }} diff --git a/template/config/file.sls b/template/config/file.sls index ce3eb6e6..fc07019d 100644 --- a/template/config/file.sls +++ b/template/config/file.sls @@ -5,7 +5,7 @@ {%- set tplroot = tpldir.split('/')[0] %} {%- set sls_package_install = tplroot ~ '.package.install' %} {%- from tplroot ~ "/map.jinja" import template with context %} -{%- from tplroot ~ "/macros.jinja" import files_switch with context %} +{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} include: - {{ sls_package_install }} diff --git a/template/macros.jinja b/template/libtofs.jinja similarity index 100% rename from template/macros.jinja rename to template/libtofs.jinja