Browse Source

fix(php/ng): don't iterate on string, make sure list is not string

tags/v0.39.0
Arthur Lutz 5 years ago
parent
commit
dbb542c4fb
5 changed files with 23 additions and 19 deletions
  1. +4
    -4
      php/ng/fpm/config.sls
  2. +5
    -4
      php/ng/fpm/init.sls
  3. +3
    -2
      php/ng/fpm/pools_config.sls
  4. +7
    -6
      php/ng/installed.jinja
  5. +4
    -3
      php/ng/map.jinja

+ 4
- 4
php/ng/fpm/config.sls View File

{% endif %} {% endif %}
{% endfor %} {% 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 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 ini = php.lookup.fpm.ini|replace(first_version, version) %}
{% set conf = php.lookup.fpm.conf|replace(first_version, version) %} {% set conf = php.lookup.fpm.conf|replace(first_version, version) %}
{% set pools = php.lookup.fpm.pools|replace(first_version, version) %} {% set pools = php.lookup.fpm.pools|replace(first_version, version) %}

+ 5
- 4
php/ng/fpm/init.sls View File

- php.ng.fpm.service - php.ng.fpm.service
- php.ng.fpm.pools - php.ng.fpm.pools


{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
extend: extend:
php_fpm_service: php_fpm_service:
service: service:
- watch: - 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_ini_config_{{ version }}
- file: php_fpm_conf_config_{{ version }} - file: php_fpm_conf_config_{{ version }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
- require: - require:
- sls: php.ng.fpm.config - 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 }}: php_fpm_ini_config_{{ version }}:
file: file:
- require: - require:

+ 3
- 2
php/ng/fpm/pools_config.sls View File

{% endfor %} {% endfor %}
{% set state = 'php_fpm_pool_conf_' ~ loop.index0 %} {% 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_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')) %} {% set fpath = first_fpath.replace(first_version, config.get('phpversion', '7.0')) %}
{% else %} {% else %}
{% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %} {% set fpath = path_join(config.get('filename', pool), php.lookup.fpm.pools) %}

+ 7
- 6
php/ng/installed.jinja View File

{% set pkgs = [] %} {% set pkgs = [] %}
{% set specials = [] %} {% set specials = [] %}


{% set pillar_php_ng_version = salt['pillar.get']('php:ng:version', '7.0') %}
{% if pkginfo is iterable and pkginfo is not string %} {% if pkginfo is iterable and pkginfo is not string %}
{% for pkg in pkginfo %} {% for pkg in pkginfo %}
{% if pkg is mapping %} {% if pkg is mapping %}
{% do specials.append(pkg) %} {% do specials.append(pkg) %}
{% else %} {% else %}
{% do pkgs.append(pkg) %} {% 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 %} {% set other_version_str = other_version|string %}
{% do pkgs.append(pkg.replace(first_version, other_version_str)) %} {% do pkgs.append(pkg.replace(first_version, other_version_str)) %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% else %} {% else %}
{% do pkgs.append(pkginfo) %} {% 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 %} {% set other_version_str = other_version|string %}
{% do pkgs.append(pkginfo.replace(first_version, other_version_str)) %} {% do pkgs.append(pkginfo.replace(first_version, other_version_str)) %}
{% endfor %} {% endfor %}

+ 4
- 3
php/ng/map.jinja View File

# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: ft=jinja # 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 %} {% else %}
{%- set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %}
{%- set phpng_version = pillar_php_ng_version|string %}
{% endif %} {% endif %}
{%- set freebsd_phpng_version = phpng_version.replace('.', '') %} {%- set freebsd_phpng_version = phpng_version.replace('.', '') %}



Loading…
Cancel
Save