From b7356b0d413e8b9efca87e0635ae16d00c82567d Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 26 Feb 2019 01:32:24 +0000 Subject: [PATCH] refactor(tplroot): use `tplroot` instead of `topdir` to match `tpldata` * Upstream feature request PR: - https://github.com/saltstack/salt/pull/51814 --- template/config/clean.sls | 10 +++++----- template/config/file.sls | 12 ++++++------ template/map.jinja | 12 ++++++------ template/pkg/clean.sls | 8 ++++---- template/pkg/install.sls | 6 +++--- template/service/clean.sls | 6 +++--- template/service/running.sls | 8 ++++---- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/template/config/clean.sls b/template/config/clean.sls index f3ee871c..db854cbd 100644 --- a/template/config/clean.sls +++ b/template/config/clean.sls @@ -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 }} diff --git a/template/config/file.sls b/template/config/file.sls index aca3a7fa..f06bc26a 100644 --- a/template/config/file.sls +++ b/template/config/file.sls @@ -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 }} @@ -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'] ) ) }} diff --git a/template/map.jinja b/template/map.jinja index 5bfeb2d7..7d28ed9b 100644 --- a/template/map.jinja +++ b/template/map.jinja @@ -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', diff --git a/template/pkg/clean.sls b/template/pkg/clean.sls index 74a088e0..9b74ab56 100644 --- a/template/pkg/clean.sls +++ b/template/pkg/clean.sls @@ -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 }} diff --git a/template/pkg/install.sls b/template/pkg/install.sls index d71cbec9..47829303 100644 --- a/template/pkg/install.sls +++ b/template/pkg/install.sls @@ -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: diff --git a/template/service/clean.sls b/template/service/clean.sls index 2142822a..ae2bcbd1 100644 --- a/template/service/clean.sls +++ b/template/service/clean.sls @@ -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: diff --git a/template/service/running.sls b/template/service/running.sls index 5651744b..615347c0 100644 --- a/template/service/running.sls +++ b/template/service/running.sls @@ -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 }}