Merge pull request #298 from bawuenet/master

Do not pass full apache context to vhost templates.
This commit is contained in:
N 2020-12-08 20:25:35 +00:00 committed by GitHub
commit 0e93df3e1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -81,7 +81,7 @@
'Dav': loc.get('Dav', False), 'Dav': loc.get('Dav', False),
} %} } %}
<Location "{{ path }}"> <Location "{{ path }}">
{%- if apache.version == '2.4' %} {%- if map.version == '2.4' %}
{% if lvals.get('Require') != False %}Require {{ lvals.Require }}{% endif %} {% if lvals.get('Require') != False %}Require {{ lvals.Require }}{% endif %}
{%- else %} {%- else %}
{% if lvals.get('Order') != False %}Order {{ lvals.Order }}{% endif %} {% if lvals.get('Order') != False %}Order {{ lvals.Order }}{% endif %}
@ -98,7 +98,7 @@
'Dav': locmat.get('Dav', False), 'Dav': locmat.get('Dav', False),
} %} } %}
<LocationMatch "{{ regpath }}"> <LocationMatch "{{ regpath }}">
{%- if apache.version == '2.4' %} {%- if map.version == '2.4' %}
{% if lmvals.get('Require') != False %}Require {{ lmvals.Require }}{% endif %} {% if lmvals.get('Require') != False %}Require {{ lmvals.Require }}{% endif %}
{%- else %} {%- else %}
{% if lmvals.get('Order') != False %}Order {{ lmvals.Order }}{% endif %} {% if lmvals.get('Order') != False %}Order {{ lmvals.Order }}{% endif %}

View File

@ -5,6 +5,10 @@
{%- set sls_package_install = tplroot ~ '.package.install' %} {%- set sls_package_install = tplroot ~ '.package.install' %}
{%- set sls_service_running = tplroot ~ '.service.running' %} {%- set sls_service_running = tplroot ~ '.service.running' %}
{%- from tplroot ~ "/map.jinja" import apache with context %} {%- from tplroot ~ "/map.jinja" import apache with context %}
{#- The apache variable can grow _very_ large, especially the sites subkey.
Create a trimmed copy with config variables. #}
{%- set map = apache %}
{%- do map.pop('sites', None) %}
include: include:
- {{ sls_package_install }} - {{ sls_package_install }}
@ -20,10 +24,9 @@ apache-config-vhosts-standard-{{ id }}:
- template: {{ apache.get('template_engine', 'jinja') }} - template: {{ apache.get('template_engine', 'jinja') }}
- makedirs: True - makedirs: True
- context: - context:
apache: {{ apache|json }} id: {{ id|json }}
id: {{ id|json }} site: {{ site|json }}
site: {{ site|json }} map: {{ map|json }}
map: {{ apache|json }}
- require: - require:
- pkg: apache-package-install-pkg-installed - pkg: apache-package-install-pkg-installed
- watch_in: - watch_in: