Skip to content

Commit

Permalink
refactor(tpldir): use topdir globally in place of tpldir
Browse files Browse the repository at this point in the history
* `topdir` evaluates to the formula's root directory
* Maintains formula's portability by providing consistent navigation
  • Loading branch information
myii committed Feb 28, 2019
1 parent 422c7ac commit 2838bc9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion template/pkg/clean.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

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

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

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

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

0 comments on commit 2838bc9

Please sign in to comment.