From 2ba7c562f0727975481388275b984649a005d704 Mon Sep 17 00:00:00 2001 From: Marius van Witzenburg Date: Fri, 10 Sep 2021 15:12:49 +0200 Subject: [PATCH] fix: merge ini changes with pillar data instead of overwriting --- php/apache2/ini.sls | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/php/apache2/ini.sls b/php/apache2/ini.sls index 842d66b..a9949e6 100644 --- a/php/apache2/ini.sls +++ b/php/apache2/ini.sls @@ -4,7 +4,27 @@ {%- from tplroot ~ "/ini.jinja" import php_ini %} {%- set settings = php.ini.defaults %} -{%- do settings.update(php.apache2.ini.settings) %} +{%- for key, value in php.apache2.ini.settings.items() %} + {%- if settings[key] is defined %} + {%- do settings[key].update(value) %} + {%- else %} + {%- do settings.update({key: value}) %} + {%- endif %} +{%- endfor %} + +{%- set pillar_php_version = salt['pillar.get']('php:version', '7.0') %} +{%- if pillar_php_version is iterable and pillar_php_version is not string %} + {%- for version in pillar_php_version %} + {%- set first_version = pillar_php_version[0]|string %} + {%- set ini = php.lookup.apache2.ini|replace(first_version, version) %} +php_apache2_ini_{{ version }}: + {{ php_ini(ini, + 'php_apache2_ini_' ~ version, + php.apache2.ini.opts, + settings + ) }} + {%- endfor %} +{%- else %} php_apache2_ini: {{ php_ini(php.lookup.apache2.ini, @@ -12,3 +32,4 @@ php_apache2_ini: php.apache2.ini.opts, settings ) }} +{%- endif %}