Skip to content

Commit 2838bc9

Browse files
committed
refactor(tpldir): use topdir globally in place of tpldir
* `topdir` evaluates to the formula's root directory * Maintains formula's portability by providing consistent navigation
1 parent 422c7ac commit 2838bc9

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

template/pkg/clean.sls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=sls
33

4-
{%- from salt['file.dirname'](tpldir) ~ "/map.jinja" import template with context %}
4+
{#- Get the `topdir` from `tpldir` #}
5+
{%- set topdir = tpldir.split('/')[0] %}
6+
{%- from topdir ~ "/map.jinja" import template with context %}
57
68
template-service-dead:
79
service.dead:

template/pkg/config.sls

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=sls
33

4+
{#- Get the `topdir` from `tpldir` #}
45
{%- set topdir = tpldir.split('/')[0] %}
5-
{%- from salt['file.dirname'](tpldir) ~ "/map.jinja" import template with context %}
6-
{%- from salt['file.dirname'](tpldir) ~ "/macros.jinja" import files_switch with context %}
6+
{%- from topdir ~ "/map.jinja" import template with context %}
7+
{%- from topdir ~ "/macros.jinja" import files_switch with context %}
78
89
include:
910
- .install

template/pkg/install.sls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=sls
33

4-
{%- from salt['file.dirname'](tpldir) ~ "/map.jinja" import template with context %}
4+
{#- Get the `topdir` from `tpldir` #}
5+
{%- set topdir = tpldir.split('/')[0] %}
6+
{%- from topdir ~ "/map.jinja" import template with context %}
57
68
template-pkg:
79
pkg.installed:

template/pkg/service.sls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=sls
33

4-
{%- from salt['file.dirname'](tpldir) ~ "/map.jinja" import template with context %}
4+
{#- Get the `topdir` from `tpldir` #}
5+
{%- set topdir = tpldir.split('/')[0] %}
6+
{%- from topdir ~ "/map.jinja" import template with context %}
57
68
include:
79
- .config

0 commit comments

Comments
 (0)