Skip to content

Commit

Permalink
refactor: moving jinja to libs subfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
vveliev-tc committed Nov 16, 2022
1 parent 21ef5f5 commit 8a974c7
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion TEMPLATE/_mapdata/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split("/")[0] %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata with context %}
{%- set _mapdata = {
"values": mapdata,
Expand Down
2 changes: 1 addition & 1 deletion TEMPLATE/config/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
include:
- {{ sls_service_clean }}
Expand Down
4 changes: 2 additions & 2 deletions TEMPLATE/config/file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_package_install = tplroot ~ '.package.install' %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/jinja/libtofs.jinja" import files_switch with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/libtofs.jinja" import files_switch with context %}
include:
- {{ sls_package_install }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split("/")[0] %}
{%- from tplroot ~ "/jinja/libmatchers.jinja" import parse_matchers, query_map with context %}
{%- from tplroot ~ "/libs/libmatchers.jinja" import parse_matchers, query_map with context %}

{%- set _default_config_dirs = [
"parameters/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split("/")[0] %}
{%- from tplroot ~ "/jinja/libsaltcli.jinja" import cli with context %}
{%- from tplroot ~ "/libs/libsaltcli.jinja" import cli with context %}

{%- set query_map = {
"C": "config.get",
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions TEMPLATE/jinja/map.jinja → TEMPLATE/libs/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split("/")[0] %}
{%- from tplroot ~ "/jinja/libmapstack.jinja" import mapstack with context %}
{%- from tplroot ~ "/libs/libmapstack.jinja" import mapstack with context %}

{#- Where to lookup parameters source files #}
{%- set formula_param_dir = tplroot ~ "/parameters" %}
Expand Down Expand Up @@ -63,4 +63,4 @@

{#- Per formula post-processing of `mapdata` if it exists #}
{%- do salt["log.debug"]("map.jinja: post-processing of 'mapdata'") %}
{%- include tplroot ~ "/jinja/post-map.jinja" ignore missing %}
{%- include tplroot ~ "/libs/post-map.jinja" ignore missing %}
2 changes: 1 addition & 1 deletion TEMPLATE/package/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_clean = tplroot ~ '.config.clean' %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
include:
- {{ sls_config_clean }}
Expand Down
2 changes: 1 addition & 1 deletion TEMPLATE/package/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
TEMPLATE-package-install-pkg-installed:
pkg.installed:
Expand Down
2 changes: 1 addition & 1 deletion TEMPLATE/service/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
TEMPLATE-service-clean-service-dead:
service.dead:
Expand Down
2 changes: 1 addition & 1 deletion TEMPLATE/service/running.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_file = tplroot ~ '.config.file' %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
include:
- {{ sls_config_file }}
Expand Down
2 changes: 1 addition & 1 deletion TEMPLATE/subcomponent/config/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
include:
- {{ sls_service_clean }}
Expand Down
4 changes: 2 additions & 2 deletions TEMPLATE/subcomponent/config/file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_file = tplroot ~ '.config.file' %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/jinja/libtofs.jinja" import files_switch with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/libtofs.jinja" import files_switch with context %}
include:
- {{ sls_config_file }}
Expand Down
8 changes: 4 additions & 4 deletions docs/map.jinja.rst
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ Here is the best way to use it in an ``sls`` file:
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split("/")[0] %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
test-does-nothing-but-display-TEMPLATE-as-json:
test.nop:
Expand All @@ -480,8 +480,8 @@ Here is an example based on `template-formula/TEMPLATE/config/file.sls`_:
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_package_install = tplroot ~ '.package.install' %}
{%- from tplroot ~ "/jinja/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/jinja/libtofs.jinja" import files_switch with context %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as TEMPLATE with context %}
{%- from tplroot ~ "/libs/libtofs.jinja" import files_switch with context %}
include:
- {{ sls_package_install }}
Expand Down Expand Up @@ -536,7 +536,7 @@ This ``sls`` file expose a ``TEMPLATE`` context variable to the jinja template w
.. _roots: https://docs.saltproject.io/en/latest/ref/file_server/all/salt.fileserver.roots.html
.. _gitfs: https://docs.saltproject.io/en/latest/topics/tutorials/gitfs.html
.. _salt.slsutil.merge: https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.slsutil.html#salt.modules.slsutil.merge
.. _traverse: https://docs.saltproject.io/en/latest/topics/jinja/index.html#traverse
.. _traverse: https://docs.saltproject.io/en/latest/topics/libs/index.html#traverse
.. _salt-ssh: https://docs.saltproject.io/en/latest/topics/ssh/
.. _template-formula/TEMPLATE/config/file.sls: https://github.com/saltstack-formulas/template-formula/blob/master/TEMPLATE/config/file.sls
.. _bug 58726: https://github.com/saltstack/salt/issues/58726

0 comments on commit 8a974c7

Please sign in to comment.