Skip to content

Commit 88373e3

Browse files
authored
fix(vhosts/cleanup): check sites-enabled dir exists before listing it
Co-authored-by: Tristan Charbonneau <[email protected]> Fix #278
1 parent 7dacabc commit 88373e3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

apache/vhosts/cleanup.sls

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ include:
2121
{% endfor %}
2222
2323
24-
{% for filename in salt['file.readdir']('/etc/apache2/sites-enabled/') %}
25-
{% if filename not in valid_sites %}
24+
{% if salt['file.directory_exists'](dirpath) %}
25+
{% for filename in salt['file.readdir'](dirpath) %}
26+
{% if filename not in valid_sites %}
2627
2728
a2dissite {{ filename }}:
2829
cmd.run:
@@ -34,8 +35,9 @@ a2dissite {{ filename }}:
3435
- module: apache-reload
3536
- service: apache
3637
37-
{% endif %}
38-
{% endfor %}
38+
{% endif %}
39+
{% endfor %}
40+
{% endif %}
3941
4042
4143
{% endif %}{# Debian #}

0 commit comments

Comments
 (0)