diff --git a/php/ng/fpm/config.sls b/php/ng/fpm/config.sls index 0129034..a62d364 100644 --- a/php/ng/fpm/config.sls +++ b/php/ng/fpm/config.sls @@ -11,11 +11,11 @@ {% endif %} {% endfor %} - -{% if salt['pillar.get']('php:ng:version') is iterable %} - {% for version in salt['pillar.get']('php:ng:version') %} +{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %} +{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %} + {% for version in pillar_php_ng_version %} {% set conf_settings = odict(php.lookup.fpm.defaults) %} - {% set first_version = salt['pillar.get']('php:ng:version')[0]|string %} + {% set first_version = pillar_php_ng_version[0]|string %} {% set ini = php.lookup.fpm.ini|replace(first_version, version) %} {% set conf = php.lookup.fpm.conf|replace(first_version, version) %} {% set pools = php.lookup.fpm.pools|replace(first_version, version) %} diff --git a/php/ng/fpm/init.sls b/php/ng/fpm/init.sls index b7f952b..e6b4e3a 100644 --- a/php/ng/fpm/init.sls +++ b/php/ng/fpm/init.sls @@ -5,12 +5,13 @@ include: - php.ng.fpm.service - php.ng.fpm.pools +{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %} extend: php_fpm_service: service: - watch: - {% if salt['pillar.get']('php:ng:version') is iterable %} - {% for version in salt['pillar.get']('php:ng:version') %} + {% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %} + {% for version in pillar_php_ng_version %} - file: php_fpm_ini_config_{{ version }} - file: php_fpm_conf_config_{{ version }} {% endfor %} @@ -20,8 +21,8 @@ extend: {% endif %} - require: - sls: php.ng.fpm.config - {% if salt['pillar.get']('php:ng:version') is iterable %} - {% for version in salt['pillar.get']('php:ng:version') %} + {% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %} + {% for version in pillar_php_ng_version %} php_fpm_ini_config_{{ version }}: file: - require: diff --git a/php/ng/fpm/pools_config.sls b/php/ng/fpm/pools_config.sls index a65dfc8..6850ad6 100644 --- a/php/ng/fpm/pools_config.sls +++ b/php/ng/fpm/pools_config.sls @@ -18,9 +18,10 @@ {% endfor %} {% set state = 'php_fpm_pool_conf_' ~ loop.index0 %} -{% if salt['pillar.get']('php:ng:version') is iterable %} +{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %} +{% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %} {% set first_fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %} - {% set first_version = salt['pillar.get']('php:ng:version')[0]|string %} + {% set first_version = pillar_php_ng_version[0]|string %} {% set fpath = first_fpath.replace(first_version, config.get('phpversion', '7.0')) %} {% else %} {% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %} diff --git a/php/ng/installed.jinja b/php/ng/installed.jinja index 808be89..a9f006c 100644 --- a/php/ng/installed.jinja +++ b/php/ng/installed.jinja @@ -10,15 +10,16 @@ {% set pkgs = [] %} {% set specials = [] %} +{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %} {% if pkginfo is iterable and pkginfo is not string %} {% for pkg in pkginfo %} {% if pkg is mapping %} {% do specials.append(pkg) %} {% else %} {% do pkgs.append(pkg) %} - {% if salt['pillar.get']('php:ng:version') is iterable %} - {% set first_version = salt['pillar.get']('php:ng:version')[0]|string %} - {% for other_version in salt['pillar.get']('php:ng:version') %} + {% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %} + {% set first_version = pillar_php_ng_version[0]|string %} + {% for other_version in pillar_php_ng_version %} {% set other_version_str = other_version|string %} {% do pkgs.append(pkg.replace(first_version, other_version_str)) %} {% endfor %} @@ -27,9 +28,9 @@ {% endfor %} {% else %} {% do pkgs.append(pkginfo) %} - {% if salt['pillar.get']('php:ng:version') is iterable %} - {% set first_version = salt['pillar.get']('php:ng:version')[0]|string %} - {% for other_version in salt['pillar.get']('php:ng:version') %} + {% if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %} + {% set first_version = pillar_php_ng_version[0]|string %} + {% for other_version in pillar_php_ng_version %} {% set other_version_str = other_version|string %} {% do pkgs.append(pkginfo.replace(first_version, other_version_str)) %} {% endfor %} diff --git a/php/ng/map.jinja b/php/ng/map.jinja index 36678b6..4d214ab 100644 --- a/php/ng/map.jinja +++ b/php/ng/map.jinja @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- # vim: ft=jinja -{%- if salt['pillar.get']('php:ng:version') is iterable %} - {%- set phpng_version = salt['pillar.get']('php:ng:version')[0]|string %} +{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %} +{%- if pillar_php_ng_version is iterable and pillar_php_ng_version is not string %} + {%- set phpng_version = pillar_php_ng_version[0]|string %} {% else %} - {%- set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %} + {%- set phpng_version = pillar_php_ng_version|string %} {% endif %} {%- set freebsd_phpng_version = phpng_version.replace('.', '') %}