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.
```bash
Examining apache/vhosts/standard.tmpl of type state
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/standard.tmpl:46
<VirtualHost {% for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/standard.tmpl:70
{% if site.get('SSLCertificateChainFile') %}SSLCertificateChainFile {{ site.SSLCertificateChainFile}}{% endif %}
[201] Trailing whitespace
apache/vhosts/standard.tmpl:72
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/standard.tmpl:96
{% if dvals.get('Require') != False %}Require {{dvals.Require}}{% endif %}
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/standard.tmpl:120
{%- if lvals.get('Require') != False %}Require {{lvals.Require}}{% endif %}
```
```bash
Examining apache/vhosts/redirect.tmpl of type state
[201] Trailing whitespace
apache/vhosts/redirect.tmpl:23
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/redirect.tmpl:28
<VirtualHost {%- for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
[201] Trailing whitespace
apache/vhosts/redirect.tmpl:47
```
```bash
Examining apache/vhosts/proxy.tmpl of type state
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/proxy.tmpl:38
<VirtualHost {%- for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/proxy.tmpl:53
{% if site.get('SSLCertificateChainFile') %}SSLCertificateChainFile {{ site.SSLCertificateChainFile}}{% endif %}
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/proxy.tmpl:85
{%- if lvals.get('Require') != False %}Require {{lvals.Require}}{% endif %}
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/proxy.tmpl:102
{%- if lmvals.get('Require') != False %}Require {{lmvals.Require}}{% endif %}
```
```bash
Examining apache/vhosts/minimal.tmpl of type state
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/minimal.tmpl:25
<VirtualHost {% for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
```
```bash
Examining apache/vhosts/cleanup.sls of type state
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/vhosts/cleanup.sls:29
- onlyif: "test -L {{ dirpath}}/{{ filename }} || test -f {{ dirpath}}/{{ filename }}"
```
```bash
Examining apache/server_status.sls of type state
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/server_status.sls:7
{{apache.confdir}}/server-status{{apache.confext}}:
```
```bash
Examining apache/map.jinja of type state
[209] Jinja comment should have spaces before and after: {# comment #}
apache/map.jinja:22
{## Merge the apache pillar ##}
```
```bash
Examining apache/init.sls of type state
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/init.sls:15
service.{{apache.service_state}}:
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/init.sls:30
- cmd: {{apache.custom_reload_command|default('apachectl graceful')}}
[206] Jinja variables should have spaces before and after: {{ var_name }}
apache/init.sls:41
- cmd: {{apache.custom_reload_command|default('apachectl graceful')}}
```
```bash
Examining apache/files/FreeBSD/apache-2.4.config.jinja of type state
[201] Trailing whitespace
apache/files/FreeBSD/apache-2.4.config.jinja:171
```
```bash
apache-formula$ yamllint -s .
./pillar.example
2:1 warning missing document start "---" (document-start)
5:26 warning truthy value should be one of [false, true] (truthy)
50:18 warning too few spaces before comment (comments)
51:16 warning truthy value should be one of [false, true] (truthy)
52:57 warning too few spaces before comment (comments)
52:89 error line too long (104 > 88 characters) (line-length)
67:33 warning truthy value should be one of [false, true] (truthy)
67:38 warning too few spaces before comment (comments)
69:31 warning too few spaces before comment (comments)
70:8 warning missing starting space in comment (comments)
75:53 warning too few spaces before comment (comments)
75:89 error line too long (98 > 88 characters) (line-length)
76:55 warning too few spaces before comment (comments)
76:89 error line too long (101 > 88 characters) (line-length)
78:50 warning too few spaces before comment (comments)
79:89 error line too long (95 > 88 characters) (line-length)
82:47 warning too few spaces before comment (comments)
83:54 warning too few spaces before comment (comments)
83:89 error line too long (100 > 88 characters) (line-length)
84:58 warning too few spaces before comment (comments)
84:89 error line too long (109 > 88 characters) (line-length)
93:32 warning too few spaces before comment (comments)
100:89 error line too long (105 > 88 characters) (line-length)
101:33 error trailing spaces (trailing-spaces)
102:16 warning truthy value should be one of [false, true] (truthy)
231:20 warning truthy value should be one of [false, true] (truthy)
242:32 warning too few spaces before comment (comments)
249:20 warning truthy value should be one of [false, true] (truthy)
254:20 warning truthy value should be one of [false, true] (truthy)
260:21 warning truthy value should be one of [false, true] (truthy)
283:8 warning missing starting space in comment (comments)
284:8 warning missing starting space in comment (comments)
297:15 warning too few spaces before comment (comments)
328:18 warning truthy value should be one of [false, true] (truthy)
330:20 warning truthy value should be one of [false, true] (truthy)
342:15 error empty value in block mapping (empty-values)
345:18 warning truthy value should be one of [false, true] (truthy)
348:18 warning truthy value should be one of [false, true] (truthy)
355:18 warning truthy value should be one of [false, true] (truthy)
358:89 error line too long (91 > 88 characters) (line-length)
359:26 warning truthy value should be one of [false, true] (truthy)
362:89 error line too long (99 > 88 characters) (line-length)
365:89 error line too long (267 > 88 characters) (line-length)
367:21 warning truthy value should be one of [false, true] (truthy)
369:26 warning truthy value should be one of [false, true] (truthy)
371:1 error too many blank lines (1 > 0) (empty-lines)
./apache/osfingermap.yaml
3:1 warning missing document start "---" (document-start)
./apache/modsecurity.yaml
4:1 warning missing document start "---" (document-start)
6:18 warning truthy value should be one of [false, true] (truthy)
7:20 warning truthy value should be one of [false, true] (truthy)
14:18 warning truthy value should be one of [false, true] (truthy)
15:20 warning truthy value should be one of [false, true] (truthy)
22:18 warning truthy value should be one of [false, true] (truthy)
23:20 warning truthy value should be one of [false, true] (truthy)
./apache/defaults.yaml
4:1 warning missing document start "---" (document-start)
5:26 warning truthy value should be one of [false, true] (truthy)
7:19 warning truthy value should be one of [false, true] (truthy)
10:18 warning truthy value should be one of [false, true] (truthy)
11:20 warning truthy value should be one of [false, true] (truthy)
./apache/oscodenamemap.yaml
4:1 warning missing document start "---" (document-start)
4:8 error trailing spaces (trailing-spaces)
9:8 error trailing spaces (trailing-spaces)
14:7 error trailing spaces (trailing-spaces)
19:6 error trailing spaces (trailing-spaces)
24:8 error trailing spaces (trailing-spaces)
29:9 error trailing spaces (trailing-spaces)
34:7 error trailing spaces (trailing-spaces)
39:8 error trailing spaces (trailing-spaces)
44:8 error trailing spaces (trailing-spaces)
50:9 error trailing spaces (trailing-spaces)
61:1 error too many blank lines (1 > 0) (empty-lines)
./apache/osfamilymap.yaml
4:1 warning missing document start "---" (document-start)
16:89 error line too long (104 > 88 characters) (line-length)
43:89 error line too long (105 > 88 characters) (line-length)
56:16 warning truthy value should be one of [false, true] (truthy)
114:11 error empty value in block mapping (empty-values)
114:11 error trailing spaces (trailing-spaces)
./test/salt/pillar/default.sls
5:26 warning truthy value should be one of [false, true] (truthy)
7:18 warning truthy value should be one of [false, true] (truthy)
8:20 warning truthy value should be one of [false, true] (truthy)
```
Some configuration changes only take effect after a restart of the service.
When the module 'apache-reload' is triggered too early, it fails which results
in a false-negative result of the Salt run.
In order to fix that 'apache-restart' and the service definition itself are
put before 'apache-reload'. Reload should always succeed if restart did.
The formula currently adds a Listen directive for the port '*' if
any configured vhost is configured to listen on :* which does not
work and instead prevents apache from starting.
It is possible to prevent this by setting the
exclude_listen_directive pillar to True but this is a manual
workaround.
Instead, this commit excludes :* Listeners automatically.
When using the mod_ssl state on Red Hat family systems the httpd
server will currently not start.
This is due to duplicate Listen directives provided in the
ssl.conf file shipped with the mod_ssl rpm package and the directives
configured by saltstack.
The easy solution is to just ensure the rpm shipped mod_ssl is removed.
The docroot fix from PR#240 worked fine for default servers.
But as soon as one uses vhosts this broke as the vhosts were
created under the docroot in /var/www/html rather than the better
/var/www.
Fix this by differentiating between docroot and wwwdir.
Further allow to override both in Red Hat-style configs.
The override allows to reuse this formula for the softwarecollections
rpms.
SUSE reads additional FLAGS that are used on the server start. They are
read from the APACHE_SERVER_FLAGS key, so we use a2enflag/a2disflag to
set those as we do with modules.
Templates already fallback to SiteName before site id.
This attemps to be consistent with them, and avoid having to explicitly specify
the DocumentRoot, when the template already does the proper inference.
Other states in this formula allow changing the Apache httpd or module
package on RHEL/CentOS, e.g., one may use packages from the httpd24
SCL to install newer versions than in the base repositories. This
changes the apache.mod_ssl SLS to match them.