fix(vhosts/cleanup): check sites-enabled dir exists before listing it

Co-authored-by: Tristan Charbonneau <tcharbonneau@oceanet-technology.com>

Fix #278
This commit is contained in:
Yoda-BZH 2020-06-22 00:37:12 +02:00 committed by GitHub
parent 7dacabcd67
commit 88373e38f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,8 +21,9 @@ include:
{% endfor %}
{% for filename in salt['file.readdir']('/etc/apache2/sites-enabled/') %}
{% if filename not in valid_sites %}
{% if salt['file.directory_exists'](dirpath) %}
{% for filename in salt['file.readdir'](dirpath) %}
{% if filename not in valid_sites %}
a2dissite {{ filename }}:
cmd.run:
@ -34,8 +35,9 @@ a2dissite {{ filename }}:
- module: apache-reload
- service: apache
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}{# Debian #}