Skip to content

Commit

Permalink
refactor(tplroot): use tplroot instead of topdir to match tpldata
Browse files Browse the repository at this point in the history
* Upstream feature request PR:
  - saltstack/salt#51814
  • Loading branch information
myii committed Feb 28, 2019
1 parent bf1039c commit b7356b0
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 31 deletions.
10 changes: 5 additions & 5 deletions template/config/clean.sls
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `topdir` from `tpldir` #}
{%- set topdir = tpldir.split('/')[0] %}
{%- set sls_service_clean = topdir ~ '.service.clean' %}
{%- from topdir ~ "/map.jinja" import template with context %}
{%- from topdir ~ "/macros.jinja" import files_switch with context %}
{#- Get the `tplroot` from `tpldir` #}
{%- 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 %}
include:
- {{ sls_service_clean }}
Expand Down
12 changes: 6 additions & 6 deletions template/config/file.sls
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `topdir` from `tpldir` #}
{%- set topdir = tpldir.split('/')[0] %}
{%- set sls_pkg_install = topdir ~ '.pkg.install' %}
{%- from topdir ~ "/map.jinja" import template with context %}
{%- from topdir ~ "/macros.jinja" import files_switch with context %}
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_pkg_install = tplroot ~ '.pkg.install' %}
{%- from tplroot ~ "/map.jinja" import template with context %}
{%- from tplroot ~ "/macros.jinja" import files_switch with context %}
include:
- {{ sls_pkg_install }}
Expand All @@ -15,7 +15,7 @@ template-config:
- name: {{ template.config }}
- source: {{ files_switch(
salt['config.get'](
topdir ~ ':tofs:files:template-config',
tplroot ~ ':tofs:files:template-config',
['example.tmpl', 'example.tmpl.jinja']
)
) }}
Expand Down
12 changes: 6 additions & 6 deletions template/map.jinja
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
# vim: ft=jinja

{#- Get the `topdir` from `tpldir` #}
{%- set topdir = tpldir.split('/')[0] %}
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{#- Start imports as #}
{%- import_yaml topdir ~ "/defaults.yaml" or {} as default_settings %}
{%- import_yaml topdir ~ "/osfamilymap.yaml" or {} as osfamilymap %}
{%- import_yaml topdir ~ "/osmap.yaml" or {} as osmap %}
{%- import_yaml topdir ~ "/osfingermap.yaml" or {} as osfingermap %}
{%- import_yaml tplroot ~ "/defaults.yaml" or {} as default_settings %}
{%- import_yaml tplroot ~ "/osfamilymap.yaml" or {} as osfamilymap %}
{%- import_yaml tplroot ~ "/osmap.yaml" or {} as osmap %}
{%- import_yaml tplroot ~ "/osfingermap.yaml" or {} as osfingermap %}

{% set defaults = salt['grains.filter_by'](default_settings,
default='template',
Expand Down
8 changes: 4 additions & 4 deletions template/pkg/clean.sls
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `topdir` from `tpldir` #}
{%- set topdir = tpldir.split('/')[0] %}
{%- set sls_config_clean = topdir ~ '.config.clean' %}
{%- from topdir ~ "/map.jinja" import template with context %}
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_clean = tplroot ~ '.config.clean' %}
{%- from tplroot ~ "/map.jinja" import template with context %}
include:
- {{ sls_config_clean }}
Expand Down
6 changes: 3 additions & 3 deletions template/pkg/install.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `topdir` from `tpldir` #}
{%- set topdir = tpldir.split('/')[0] %}
{%- from topdir ~ "/map.jinja" import template with context %}
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import template with context %}
template-pkg:
pkg.installed:
Expand Down
6 changes: 3 additions & 3 deletions template/service/clean.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `topdir` from `tpldir` #}
{%- set topdir = tpldir.split('/')[0] %}
{%- from topdir ~ "/map.jinja" import template with context %}
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import template with context %}
template-service-dead:
service.dead:
Expand Down
8 changes: 4 additions & 4 deletions template/service/running.sls
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `topdir` from `tpldir` #}
{%- set topdir = tpldir.split('/')[0] %}
{%- set sls_config_file = topdir ~ '.config.file' %}
{%- from topdir ~ "/map.jinja" import template with context %}
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_file = tplroot ~ '.config.file' %}
{%- from tplroot ~ "/map.jinja" import template with context %}
include:
- {{ sls_config_file }}
Expand Down

0 comments on commit b7356b0

Please sign in to comment.