Skip to content

Commit d4772f9

Browse files
committed
fix(fpm): be sure to restart all Php instances in case of multi-versions
1 parent d4fc842 commit d4772f9

File tree

3 files changed

+62
-13
lines changed

3 files changed

+62
-13
lines changed

php/fpm/init.sls

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,49 @@ include:
66
- php.fpm.pools
77

88
{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}
9+
910
extend:
10-
php_fpm_service:
11+
{% if pillar_php_version is iterable and pillar_php_version is not string %}
12+
{% for version in pillar_php_version %}
13+
14+
php_fpm_service_{{ version }}:
1115
service:
1216
- watch:
13-
{% if pillar_php_version is iterable and pillar_php_version is not string %}
14-
{% for version in pillar_php_version %}
1517
- file: php_fpm_ini_config_{{ version }}
1618
- file: php_fpm_conf_config_{{ version }}
17-
{% endfor %}
18-
{% else %}
19-
- file: php_fpm_ini_config
20-
- file: php_fpm_conf_config
21-
{% endif %}
2219
- require:
2320
- sls: php.fpm.config
24-
{% if pillar_php_version is iterable and pillar_php_version is not string %}
25-
{% for version in pillar_php_version %}
21+
2622
php_fpm_ini_config_{{ version }}:
2723
file:
2824
- require:
2925
- pkg: php_install_fpm
26+
3027
php_fpm_conf_config_{{ version }}:
3128
file:
3229
- require:
3330
- pkg: php_install_fpm
34-
{% endfor %}
35-
{% else %}
31+
32+
{% endfor %}
33+
34+
{% else %}
35+
36+
php_fpm_service:
37+
service:
38+
- watch:
39+
- file: php_fpm_ini_config
40+
- file: php_fpm_conf_config
41+
- require:
42+
- sls: php.fpm.config
43+
3644
php_fpm_ini_config:
3745
file:
3846
- require:
3947
- pkg: php_install_fpm
48+
4049
php_fpm_conf_config:
4150
file:
4251
- require:
4352
- pkg: php_install_fpm
44-
{% endif %}
53+
54+
{% endif %}

php/fpm/pools.sls

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,31 @@ include:
88
- php.fpm.service
99
- php.fpm.pools_config
1010
11+
{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}
12+
1113
{% if pool_states %}
1214
extend:
15+
16+
{% if pillar_php_version is iterable and pillar_php_version is not string %}
17+
{% for version in pillar_php_version %}
18+
php_fpm_service_{{ version }}:
19+
service:
20+
- watch:
21+
{{ file_requisites(pool_states) }}
22+
- require:
23+
{{ file_requisites(pool_states) }}
24+
25+
{% endfor %}
26+
27+
{% else %}
28+
1329
php_fpm_service:
1430
service:
1531
- watch:
1632
{{ file_requisites(pool_states) }}
1733
- require:
1834
{{ file_requisites(pool_states) }}
35+
36+
{% endif %}
37+
1938
{% endif %}

php/fpm/service.sls

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,28 @@
33
{% from "php/macro.jinja" import sls_block %}
44
55
{% set service_function = {True:'running', False:'dead'}.get(php.fpm.service.enabled) %}
6+
{% set pillar_php_version = salt['pillar.get']('php:version', '7.0') %}
67
78
include:
89
- php.fpm.install
910
11+
{% if pillar_php_version is iterable and pillar_php_version is not string %}
12+
{% for version in pillar_php_version %}
13+
14+
php_fpm_service_{{ version }}:
15+
service.{{ service_function }}:
16+
{{ sls_block(php.fpm.service.opts) }}
17+
- name: {{ 'php' ~ version ~ '-fpm' }}
18+
- enable: {{ php.fpm.service.enabled }}
19+
- require:
20+
- sls: php.fpm.install
21+
- watch:
22+
- pkg: php_install_fpm
23+
24+
{% endfor %}
25+
26+
{% else %}
27+
1028
php_fpm_service:
1129
service.{{ service_function }}:
1230
{{ sls_block(php.fpm.service.opts) }}
@@ -16,3 +34,5 @@ php_fpm_service:
1634
- sls: php.fpm.install
1735
- watch:
1836
- pkg: php_install_fpm
37+
38+
{% endif %}

0 commit comments

Comments
 (0)