From 21045c7a7b46d639c2d81c5793ad6e6d9d34b66b Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 18 Dec 2019 15:48:02 +0100 Subject: [PATCH] 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' [...] 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. --- apache/files/Debian/mpm/mpm_prefork.conf.jinja | 2 +- apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apache/files/Debian/mpm/mpm_prefork.conf.jinja b/apache/files/Debian/mpm/mpm_prefork.conf.jinja index 5b6eb81..d07c9ed 100644 --- a/apache/files/Debian/mpm/mpm_prefork.conf.jinja +++ b/apache/files/Debian/mpm/mpm_prefork.conf.jinja @@ -14,7 +14,7 @@ StartServers {{ mpm_param['start_servers'] | d('5') }} 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') }} {%- endif %} MinSpareServers {{ mpm_param['min_spare_servers'] | d('5') }} diff --git a/apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja b/apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja index 8831d12..336c034 100644 --- a/apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja +++ b/apache/files/RedHat/conf.modules.d/00-mpm.conf.jinja @@ -21,7 +21,7 @@ LoadModule {{ mpm_module }}_module modules/mod_{{ mpm_module }}.so StartServers {{ mpm_param['start_servers'] | d('5') }} 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') }} {%- endif %} MinSpareServers {{ mpm_param['min_spare_servers'] | d('5') }}