fix(mod_mpm): cast to int to avoid Jinja type mismatch error

This fixes the following error when Jinja tries to process
`mpm_prefork.conf.jinja` or `00-mpm.conf.jinja`, when it processes the
`max_request_workers` comparison:

```
Unable to manage file: Jinja error: '>=' not supported between instances of 'str' and 'int'
[...]
<IfModule mpm_prefork_module>
  StartServers {{ mpm_param['start_servers'] | d('5') }}
  MaxRequestWorkers {{ mpm_param['max_request_workers'] | d('150') }}
{%- if mpm_param['max_request_workers'] | d('150') >= 256 %}    <======================
  ServerLimit {{ mpm_param['max_request_workers'] | d('150') }}
{%- endif %}
  MinSpareServers {{ mpm_param['min_spare_servers'] | d('5') }}
  MaxSpareServers {{ mpm_param['max_spare_servers'] | d('10') }}
  MaxConnectionsPerChild {{ mpm_param['max_connections_per_child'] | d('0') }}
```

Add filters that convert the values to an int first.
This commit is contained in:
Dimitry Andric 2019-12-18 15:48:02 +01:00
parent 13be6f9fac
commit 21045c7a7b
2 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@
<IfModule mpm_prefork_module> <IfModule mpm_prefork_module>
StartServers {{ mpm_param['start_servers'] | d('5') }} StartServers {{ mpm_param['start_servers'] | d('5') }}
MaxRequestWorkers {{ mpm_param['max_request_workers'] | d('150') }} MaxRequestWorkers {{ mpm_param['max_request_workers'] | d('150') }}
{%- if mpm_param['max_request_workers'] | d('150') >= 256 %} {%- if mpm_param['max_request_workers'] | d('150') | int >= 256 %}
ServerLimit {{ mpm_param['max_request_workers'] | d('150') }} ServerLimit {{ mpm_param['max_request_workers'] | d('150') }}
{%- endif %} {%- endif %}
MinSpareServers {{ mpm_param['min_spare_servers'] | d('5') }} MinSpareServers {{ mpm_param['min_spare_servers'] | d('5') }}

View File

@ -21,7 +21,7 @@ LoadModule {{ mpm_module }}_module modules/mod_{{ mpm_module }}.so
<IfModule mpm_prefork_module> <IfModule mpm_prefork_module>
StartServers {{ mpm_param['start_servers'] | d('5') }} StartServers {{ mpm_param['start_servers'] | d('5') }}
MaxRequestWorkers {{ mpm_param['max_request_workers'] | d('150') }} MaxRequestWorkers {{ mpm_param['max_request_workers'] | d('150') }}
{%- if mpm_param['max_request_workers'] | d('150') >= 256 %} {%- if mpm_param['max_request_workers'] | d('150') | int >= 256 %}
ServerLimit {{ mpm_param['max_request_workers'] | d('150') }} ServerLimit {{ mpm_param['max_request_workers'] | d('150') }}
{%- endif %} {%- endif %}
MinSpareServers {{ mpm_param['min_spare_servers'] | d('5') }} MinSpareServers {{ mpm_param['min_spare_servers'] | d('5') }}