Browse Source

Merge pull request #42 from RyPeck/bugfix/a2dissite_from_pillar

Fix case where state != enabled causes error
tags/v0.37.4
Nitin Madhok 9 years ago
parent
commit
93745004ca
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      apache/register_site.sls

+ 4
- 3
apache/register_site.sls View File

{% if 'name' in pillar['apache']['register-site'][site] and 'state' in pillar['apache']['register-site'][site] %} {% if 'name' in pillar['apache']['register-site'][site] and 'state' in pillar['apache']['register-site'][site] %}


{% if pillar['apache']['register-site'][site]['state'] == 'enabled' %} {% if pillar['apache']['register-site'][site]['state'] == 'enabled' %}
a2ensite {{ pillar['apache']['register-site'][site]['name'] }}:
{% set a2modid = "a2ensite " ~ pillar['apache']['register-site'][site]['name'] %}
{% else %} {% else %}
a2dissite {{ pillar['apache']['register-site'][site]['name'] }}:
{% set a2modid = "a2dissite " ~ pillar['apache']['register-site'][site]['name'] %}
{% endif %} {% endif %}
{{ a2modid }}:
cmd.run: cmd.run:
{% if pillar['apache']['register-site'][site]['state'] == 'enabled' %} {% if pillar['apache']['register-site'][site]['state'] == 'enabled' %}
- unless: test -f /etc/apache2/sites-enabled/{{ pillar['apache']['register-site'][site]['name'] }} - unless: test -f /etc/apache2/sites-enabled/{{ pillar['apache']['register-site'][site]['name'] }}
- group: root - group: root
- mode: 775 - mode: 775
- watch_in: - watch_in:
- cmd: a2ensite {{ pillar['apache']['register-site'][site]['name'] }}
- cmd: {{ a2modid }}
- module: apache-reload - module: apache-reload


{% endif %} {% endif %}

Loading…
Cancel
Save