Skip to content

Commit 5aee6e7

Browse files
committed
fix(resources): make resources' IDs unique
The new format match the format proposed in the template-formula BREAKING CHANGE: as all resources' IDs changed, other formulas depending on this formula's resources will need to be modified accordingly.
1 parent 19617a0 commit 5aee6e7

8 files changed

+67
-54
lines changed

postfix/config.sls

+32-26
Original file line numberDiff line numberDiff line change
@@ -2,78 +2,84 @@
22
include:
33
- postfix
44
5-
{{ postfix.config_path }}:
5+
postfix-config-file-directory-config-path:
66
file.directory:
7+
- name: {{ postfix.config_path }}
78
- user: root
89
- group: {{ postfix.root_grp }}
910
- dir_mode: '0755'
1011
- file_mode: '0644'
1112
- makedirs: True
1213
13-
{{ postfix.config_path }}/main.cf:
14+
postfix-config-file-managed-main.cf:
1415
file.managed:
16+
- name: {{ postfix.config_path }}/main.cf
1517
- source: salt://postfix/files/main.cf
1618
- user: root
1719
- group: {{ postfix.root_grp }}
1820
- mode: '0644'
1921
- require:
20-
- pkg: postfix
22+
- pkg: postfix-init-pkg-installed-postfix
2123
- watch_in:
22-
- service: postfix
24+
- service: postfix-init-service-running-postfix
2325
- template: jinja
2426
- context:
2527
postfix: {{ postfix|tojson }}
2628
2729
{% if 'vmail' in pillar.get('postfix', '') %}
28-
{{ postfix.config_path }}/virtual_alias_maps.cf:
30+
postfix-config-file-managed-virtual-alias-maps.cf:
2931
file.managed:
32+
- name: {{ postfix.config_path }}/virtual_alias_maps.cf
3033
- source: salt://postfix/files/virtual_alias_maps.cf
3134
- user: root
3235
- group: postfix
3336
- mode: '0640'
3437
- require:
35-
- pkg: postfix
38+
- pkg: postfix-init-pkg-installed-postfix
3639
- watch_in:
37-
- service: postfix
40+
- service: postfix-init-service-running-postfix
3841
- template: jinja
3942
40-
{{ postfix.config_path }}/virtual_mailbox_domains.cf:
43+
postfix-config-file-managed-virtual-mailbox-domains.cf:
4144
file.managed:
45+
- name: {{ postfix.config_path }}/virtual_mailbox_domains.cf
4246
- source: salt://postfix/files/virtual_mailbox_domains.cf
4347
- user: root
4448
- group: postfix
4549
- mode: '0640'
4650
- require:
47-
- pkg: postfix
51+
- pkg: postfix-init-pkg-installed-postfix
4852
- watch_in:
49-
- service: postfix
53+
- service: postfix-init-service-running-postfix
5054
- template: jinja
5155
52-
{{ postfix.config_path }}/virtual_mailbox_maps.cf:
56+
postfix-config-file-managed-virtual-mailbox-maps.cf:
5357
file.managed:
58+
- name: {{ postfix.config_path }}/virtual_mailbox_maps.cf
5459
- source: salt://postfix/files/virtual_mailbox_maps.cf
5560
- user: root
5661
- group: postfix
5762
- mode: '0640'
5863
- require:
59-
- pkg: postfix
64+
- pkg: postfix-init-pkg-installed-postfix
6065
- watch_in:
61-
- service: postfix
66+
- service: postfix-init-service-running-postfix
6267
- template: jinja
6368
{% endif %}
6469
6570
{% if salt['pillar.get']('postfix:manage_master_config', True) %}
6671
{% import_yaml "postfix/services.yaml" as postfix_master_services %}
67-
{{ postfix.config_path }}/master.cf:
72+
postfix-config-file-managed-master.cf:
6873
file.managed:
74+
- name: {{ postfix.config_path }}/master.cf
6975
- source: salt://postfix/files/master.cf
7076
- user: root
7177
- group: {{ postfix.root_grp }}
7278
- mode: '0644'
7379
- require:
74-
- pkg: postfix
80+
- pkg: postfix-init-pkg-installed-postfix
7581
- watch_in:
76-
- service: postfix
82+
- service: postfix-init-service-running-postfix
7783
- template: jinja
7884
- context:
7985
postfix: {{ postfix|tojson }}
@@ -82,23 +88,22 @@ include:
8288
8389
{%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %}
8490
85-
postfix_{{ domain }}_ssl_certificate:
86-
91+
postfix-config-file-managed-{{ domain }}-ssl-certificate:
8792
file.managed:
8893
- name: {{ postfix.config_path }}/ssl/{{ domain }}.crt
8994
- makedirs: True
9095
- contents_pillar: postfix:certificates:{{ domain }}:public_cert
9196
- watch_in:
92-
- service: postfix
97+
- service: postfix-init-service-running-postfix
9398
94-
postfix_{{ domain }}_ssl_key:
99+
postfix-config-file-managed-{{ domain }}-ssl-key:
95100
file.managed:
96101
- name: {{ postfix.config_path }}/ssl/{{ domain }}.key
97102
- mode: '0600'
98103
- makedirs: True
99104
- contents_pillar: postfix:certificates:{{ domain }}:private_key
100105
- watch_in:
101-
- service: postfix
106+
- service: postfix-init-service-running-postfix
102107
103108
{% endfor %}
104109
@@ -120,7 +125,7 @@ postfix_{{ domain }}_ssl_key:
120125
{%- if file_type in ("btree", "cdb", "cidr", "dbm", "hash", "pcre", "regexp", "sdbm") %}
121126
{%- set need_postmap = True %}
122127
{%- endif %}
123-
postfix_{{ mapping }}:
128+
postfix-config-file-managed-{{ mapping }}:
124129
file.managed:
125130
- name: {{ file_path }}
126131
- source: salt://postfix/files/mapping.j2
@@ -135,15 +140,16 @@ postfix_{{ mapping }}:
135140
- context:
136141
data: {{ data|json() }}
137142
- require:
138-
- pkg: postfix
139-
- file: {{ postfix.config_path }}/main.cf
143+
- pkg: postfix-init-pkg-installed-postfix
144+
- file: postfix-config-file-managed-main.cf
140145
{%- if need_postmap %}
146+
postfix-config-cmd-wait-{{ mapping }}:
141147
cmd.wait:
142148
- name: {{ postfix.xbin_prefix }}/sbin/postmap {{ file_path }}
143149
- cwd: /
144150
- watch:
145-
- file: {{ file_path }}
151+
- file: postfix-config-file-managed-{{ mapping }}
146152
- watch_in:
147-
- service: postfix
153+
- service: postfix-init-service-running-postfix
148154
{%- endif %}
149155
{% endfor %}

postfix/init.sls

+18-12
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,45 @@
33
{%- if grains.os_family == "Suse" %}
44
# The existence of this file prevents the system to
55
# overwrite files from salt when installing.
6-
/var/adm/postfix.configured:
6+
postfix-init-file-managed-postfix.configured:
77
file.managed:
8+
- name: /var/adm/postfix.configured
89
- contents: ''
910
- mode: '0644'
1011
- user: 'root'
1112
- group: 'root'
1213
- require_in:
13-
- pkg: postfix
14+
- pkg: postfix-init-pkg-installed-postfix
1415
{%- endif %}
1516
16-
postfix:
17+
postfix-init-pkg-installed-postfix:
1718
pkg.installed:
1819
- name: {{ postfix.package }}
1920
{%- if grains.os_family == "FreeBSD" %}
2021
- force: True
2122
- batch: True
2223
{%- endif %}
2324
- watch_in:
24-
- service: postfix
25+
- service: postfix-init-service-running-postfix
26+
27+
postfix-init-service-running-postfix:
2528
service.running:
29+
- name: postfix
2630
- enable: {{ salt['pillar.get']('postfix:enable_service', True) }}
2731
- reload: {{ salt['pillar.get']('postfix:reload_service', True) }}
2832
- require:
29-
- pkg: postfix
33+
- pkg: postfix-init-pkg-installed-postfix
3034
- watch:
31-
- pkg: postfix
35+
- pkg: postfix-init-pkg-installed-postfix
3236
3337
{%- if salt['pillar.get']('postfix:reload_service', True) %}
3438
# Restart postfix if the package was changed.
3539
# This also provides an ID to be used in a watch_in statement.
36-
postfix_service_restart:
40+
postfix-init-service-running-postfix-restart:
3741
service.running:
3842
- name: postfix
3943
- watch:
40-
- pkg: postfix
44+
- pkg: postfix-init-pkg-installed-postfix
4145
{%- endif %}
4246
4347
{# Used for newaliases, postalias and postconf #}
@@ -56,7 +60,7 @@ postfix_service_restart:
5660
{%- if file_type in ("btree", "cdb", "dbm", "hash", "sdbm") %}
5761
{%- set need_newaliases = True %}
5862
{%- endif %}
59-
postfix_alias_database:
63+
postfix-init-file-managed-alias-database:
6064
file.managed:
6165
- name: {{ file_path }}
6266
{% if salt['pillar.get']('postfix:aliases:content', None) is string %}
@@ -72,8 +76,10 @@ postfix_alias_database:
7276
data: {{ salt['pillar.get']('postfix:aliases:present') }}
7377
colon: True
7478
- require:
75-
- pkg: postfix
79+
- pkg: postfix-init-pkg-installed-postfix
80+
7681
{%- if need_newaliases %}
82+
postfix-init-cmd-wait-new-aliases:
7783
cmd.wait:
7884
- name: newaliases
7985
- cwd: /
@@ -82,13 +88,13 @@ postfix_alias_database:
8288
{%- endif %}
8389
{% else %}
8490
{%- for user, target in salt['pillar.get']('postfix:aliases:present', {}).items() %}
85-
postfix_alias_present_{{ user }}:
91+
postfix-init-alias-present-{{ user }}:
8692
alias.present:
8793
- name: {{ user }}
8894
- target: {{ target }}
8995
{%- endfor %}
9096
{%- for user in salt['pillar.get']('postfix:aliases:absent', {}) %}
91-
postfix_alias_absent_{{ user }}:
97+
postfix-init-alias-absent-{{ user }}:
9298
alias.absent:
9399
- name: {{ user }}
94100
{%- endfor %}

postfix/iptables-input.sls

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
smtp.input:
1+
postfix-iptables-iptables-chain-present-smtp-input:
22
iptables.chain_present:
3-
-
3+
- name: smtp.input
44

5-
smtp.iptables.tcp:
5+
postfix-iptables-iptables-insert-smtp-iptables-tcp:
66
iptables.insert:
7+
- name: smtp.iptables.tcp
78
- table: filter
89
- position: 1
910
- chain: smtp.input
@@ -14,11 +15,11 @@ smtp.iptables.tcp:
1415
- proto: tcp
1516
- save: True
1617

17-
smtp.iptables.filter:
18+
postfix-iptables-iptables-insert-smtp-iptables-filter:
1819
iptables.insert:
20+
- name: smtp.iptables.filter
1921
- table: filter
2022
- position: 1
2123
- chain: INPUT
2224
- jump: smtp.input
2325
- save: True
24-

postfix/mysql.sls

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% from "postfix/map.jinja" import postfix with context %}
22
3-
mysql:
3+
postfix-mysql-pkg-installed-mysql:
44
pkg.installed:
55
- name: {{ postfix.mysql_pkg }}
66
- watch_in:
7-
- service: postfix
7+
- service: postfix-init-service-running-postfix

postfix/pcre.sls

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% from "postfix/map.jinja" import postfix with context %}
22
3-
pcre:
3+
postfix-pcre-pkg-installed-pcre:
44
pkg.installed:
55
- name: {{ postfix.pcre_pkg }}
66
- watch_in:
7-
- service: postfix
7+
- service: postfix-init-service-running-postfix

postfix/policyd-spf.sls

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% from "postfix/map.jinja" import postfix with context %}
22
3-
policyd_spf:
3+
postfix-policyd-spf-pkg-installed-policyd_spf:
44
pkg.installed:
55
- name: {{ postfix.policyd_spf_pkg }}

postfix/postgrey.sls

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{% from "postfix/map.jinja" import postfix with context %}
22
3-
postgrey:
3+
postfix-postgrey-pkg-installed-postgrey:
44
pkg.installed:
55
- name: {{ postfix.postgrey_pkg }}
6-
- watch_in:
7-
- service: postgrey
86
7+
postfix-postgrey-service-running-postgrey:
98
service.running:
9+
- name: postgrey
1010
- enable: {{ salt['pillar.get']('postfix:postgrey:enable_service', True) }}
1111
- require:
12-
- pkg: postgrey
12+
- pkg: postfix-postgrey-pkg-installed-postgrey
1313
- watch:
14-
- pkg: postgrey
14+
- pkg: postfix-postgrey-pkg-installed-postgrey
1515

postfix/postsrsd.sls

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% from "postfix/map.jinja" import postfix with context %}
22
3-
postsrsd:
3+
postfix-postsrsd-pkg-latest-postsrsd:
44
pkg.latest:
55
- name: {{ postfix.postsrsd_pkg }}
66

0 commit comments

Comments
 (0)