Skip to content

Commit

Permalink
Merge pull request #47 from jle35/master
Browse files Browse the repository at this point in the history
fix(slspath): replace slspath by tpl_root
  • Loading branch information
myii authored Mar 11, 2020
2 parents bddbaa2 + 28d5a07 commit 1f4aaed
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion consul/config.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from slspath + '/map.jinja' import consul with context -%}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot + '/map.jinja' import consul with context -%}
consul-config:
file.serialize:
Expand Down
9 changes: 5 additions & 4 deletions consul/init.sls
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- if pillar.get('consul', {}).get('enabled', True) %}
{% from slspath+"/map.jinja" import consul with context %}
{% from tplroot+"/map.jinja" import consul with context %}
include:
- {{ slspath }}.install
- {{ slspath }}.config
- {{ slspath }}.service
- {{ tplroot }}.install
- {{ tplroot }}.config
- {{ tplroot }}.service
{%- endif %}
3 changes: 2 additions & 1 deletion consul/install.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from slspath + '/map.jinja' import consul with context -%}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot + '/map.jinja' import consul with context -%}
consul-dep-unzip:
pkg.installed:
Expand Down
3 changes: 2 additions & 1 deletion consul/map.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% import_yaml slspath+"/defaults.yaml" as defaults %}
{%- set tplroot = tpldir.split('/')[0] %}
{% import_yaml tplroot+"/defaults.yaml" as defaults %}

{% set consul = salt['pillar.get']('consul', default=defaults.consul, merge=True) %}

Expand Down
9 changes: 5 additions & 4 deletions consul/service.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{%- from slspath+"/map.jinja" import consul with context -%}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot+"/map.jinja" import consul with context -%}
consul-init-env:
file.managed:
Expand All @@ -18,19 +19,19 @@ consul-init-env:
consul-init-file:
file.managed:
{%- if salt['test.provider']('service').startswith('systemd') %}
- source: salt://{{ slspath }}/files/consul.service
- source: salt://{{ tplroot }}/files/consul.service
- name: /etc/systemd/system/consul.service
- template: jinja
- context:
user: {{ consul.user }}
group: {{ consul.group }}
- mode: 0644
{%- elif salt['test.provider']('service') == 'upstart' %}
- source: salt://{{ slspath }}/files/consul.upstart
- source: salt://{{ tplroot }}/files/consul.upstart
- name: /etc/init/consul.conf
- mode: 0644
{%- else %}
- source: salt://{{ slspath }}/files/consul.sysvinit
- source: salt://{{ tplroot }}/files/consul.sysvinit
- name: /etc/init.d/consul
- mode: 0755
{%- endif %}
Expand Down

0 comments on commit 1f4aaed

Please sign in to comment.