Explorar el Código

feat(context): pass `nginx` to snippets and server_config contexts

tags/v2.5.0
sticky-note hace 4 años
padre
commit
8641f0d79a
Se han modificado 2 ficheros con 11 adiciones y 0 borrados
  1. +5
    -0
      nginx/servers_config.sls
  2. +6
    -0
      nginx/snippets.sls

+ 5
- 0
nginx/servers_config.sls Ver fichero

@@ -8,6 +8,10 @@
{%- from tplroot ~ '/libtofs.jinja' import files_switch with context %}

{% set server_states = [] %}
{#- _nginx is a lightened copy of nginx map intended to passed in templates #}
{%- set _nginx = nginx.copy() %}
{%- do _nginx.pop('snippets') %}
{%- do _nginx.pop('servers') %}

# Simple path concatenation.
# Needs work to make this function on windows.
@@ -126,6 +130,7 @@ nginx_server_available_dir:
{% if 'source_path' not in settings.config %}
- context:
config: {{ settings.config|json(sort_keys=False) }}
nginx: {{ _nginx|json() }}
{% endif %}
{% if 'overwrite' in settings and settings.overwrite == False %}
- unless:

+ 6
- 0
nginx/snippets.sls Ver fichero

@@ -6,6 +6,11 @@
{%- from tplroot ~ '/map.jinja' import nginx, sls_block with context %}
{%- from tplroot ~ '/libtofs.jinja' import files_switch with context %}

{#- _nginx is a lightened copy of nginx map intended to passed in templates #}
{%- set _nginx = nginx.copy() %}
{%- do _nginx.pop('snippets') %}
{%- do _nginx.pop('servers') %}

nginx_snippets_dir:
file.directory:
{{ sls_block(nginx.servers.dir_opts) }}
@@ -22,4 +27,5 @@ nginx_snippet_{{ snippet }}:
- template: jinja
- context:
config: {{ config|json() }}
nginx: {{ _nginx|json() }}
{% endfor %}

Cargando…
Cancelar
Guardar