saltstack-formulas / php-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
57 stars 232 forks source link

Add enablerepo option to php-salt-formula #166

Closed pawelrosada closed 5 years ago

aboe76 commented 5 years ago

@pawelrosada can you add your parameter to pillar.example so it's documented

pawelrosada commented 5 years ago

@aboe76 done

aboe76 commented 5 years ago

@pawelrosada thanks for this

sticky-note commented 5 years ago

Need default value in map.jinja ? As this PR breaks Backward compatibility


----------
    Rendering SLS 'base:php.ng.fpm.install' failed: Jinja variable 'enable_php_repo' is undefined
/var/cache/salt/minion/files/base/php/ng/installed.jinja(94):
---
[...]

php_install_{{ state }}:
  pkg.installed:
    - name: {{ state }}
    - pkgs: {{ pkgs|json() }}
{% if enable_php_repo %}    <======================
    - enablerepo: {{ enable_php_repo }}
{% endif %}

{% for pkg in specials %}

[...]
---```
pawelrosada commented 5 years ago

@sticky-note {% set enable_php_repo = salt['pillar.get']('php:ng:lookup:enable_php_repo', False) %}

Variable is initialized in default (false). With version of SaltStack do you use?

sticky-note commented 5 years ago

The var is initialized inside the elif statement for RedHat only: https://github.com/saltstack-formulas/php-formula/blob/0c923245e67c31bd51b78595bae57ad066c2a31b/php/ng/installed.jinja#L75 and is ALWAYS read (-> outside if elsif else ). That's because it is never initialized for Debian or all other OSes but RedHat.