浏览代码

Merge ff9a5b38f8 into 5171efec21

pull/266/merge
Yoda-BZH 1年前
父节点
当前提交
5accb9b7ea
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 20 次插入2 次删除
  1. +20
    -2
      nginx/servers_config.sls

+ 20
- 2
nginx/servers_config.sls 查看文件

@@ -88,7 +88,6 @@ nginx_server_enabled_dir:
file.directory:
{{ sls_block(nginx.servers.dir_opts) }}
- name: {{ nginx.lookup.server_enabled }}
- clean: {{ nginx.servers.purge_servers_config }}

# If enabled and available are not the same, create available
{% if nginx.lookup.server_enabled != nginx.lookup.server_available -%}
@@ -96,7 +95,6 @@ nginx_server_available_dir:
file.directory:
{{ sls_block(nginx.servers.dir_opts) }}
- name: {{ nginx.lookup.server_available }}
- clean: {{ nginx.servers.purge_servers_config }}
{%- endif %}

# Managed enabled/disabled state for servers
@@ -162,3 +160,23 @@ nginx_server_available_dir:
{%- endif %} {# enabled != available_dir #}
{% endif %}
{% endfor %}


{# Add . and .. to make it easier to not clean those #}
{% set valid_sites = ['.', '..', ] %}

{# Take sites from nginx.servers.managed #}
{% for server, settings in salt['pillar.get']('nginx:servers:managed', {}).items() %}
{% do valid_sites.append(server) %}
{% endfor %}

{% if salt['file.directory_exists'](nginx.lookup.server_enabled) %}
{% for filename in salt['file.readdir'](nginx.lookup.server_enabled) %}
{% if filename not in valid_sites %}

{{ nginx.lookup.server_enabled ~ '/' ~ filename }}:
file.absent

{% endif %}
{% endfor %}
{% endif %}

正在加载...
取消
保存