Skip to content

Commit 37a9329

Browse files
committed
refactor(salt-master): provide backward compatible states
This permit to not break user states which depends on this one.
1 parent 928b1a7 commit 37a9329

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

salt/master/init.sls

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

4+
{#- Get the `tplroot` from `tpldir` #}
5+
{%- set tplroot = tpldir.split('/')[0] %}
6+
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
7+
48
include:
59
- .package
610
- .config
711
- .service
12+
13+
{#- Be backward compatible #}
14+
{%- if grains.kernel != 'Windows' %}
15+
{%- if grains.os == "MacOS" %}
16+
salt-master-macos:
17+
test.show_notification:
18+
- name: salt-master-macos
19+
- text: Backward compatible state for {{
20+
"'sls:" ~ tplroot ~ ".master.config.files => "
21+
~ "salt-master-config-files-macos-LaunchDaemons-file.managed'"
22+
}}
23+
{%- endif %}
24+
25+
{%- set old_states_names = [
26+
"'sls:" ~ tplroot ~ ".master.package.install => "
27+
~ "salt-master-package-install-pkg.installed'",
28+
"'sls:" ~ tplroot ~ ".master.config.files => "
29+
~ "salt-master-config-files-file.recurse'",
30+
"'sls:" ~ tplroot ~ ".master.service",
31+
] %}
32+
salt-master:
33+
test.show_notification:
34+
- name: salt-master
35+
- text: Backward compatible state for {{ old_states_names | join(", ") }}
36+
37+
{%- if salt_settings.master_remove_config %}
38+
remove-default-master-conf-file:
39+
test.show_notification:
40+
- name: remove-default-master-conf-file
41+
- text: Backward compatible state for {{
42+
"'sls:" ~ tplroot ~ ".master.config.files => "
43+
~ "salt-master-config-files-remove-old-master-conf-file.absent'"
44+
}}
45+
{%- endif %}
46+
47+
remove-old-master-conf-file:
48+
test.show_notification:
49+
- name: remove-old-master-conf-file
50+
- text: Backward compatible state for {{
51+
"'sls:" ~ tplroot ~ ".master.config.files => "
52+
~ "salt-master-config-files-remove-old-default-master-conf-file.absent'"
53+
}}
54+
{%- endif %}

0 commit comments

Comments
 (0)