Skip to content

Commit

Permalink
fix(service): don't reload ufw service if service is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
n-rodriguez committed Jul 20, 2020
1 parent 830b8fe commit c953630
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion ufw/config/applications.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
{%- set sls_reload_service = tplroot ~ '.service.reload' %}
{%- from tplroot ~ "/map.jinja" import ufw with context %}
{%- set enabled = ufw.get('enabled', False) %}
include:
- {{ sls_package_install }}
- {{ sls_enable_service }}
Expand Down Expand Up @@ -44,8 +46,9 @@ ufw-app-{{ method }}-{{ app_name }}:
{%- if comment is not none and salt['grains.get']('osfinger') != 'Debian-8' and salt['grains.get']('osfinger') != 'CentOS-6' %}
- comment: '"{{ comment }}"'
{%- endif %}
{%- if enabled %}
- listen_in:
- cmd: reload-ufw
{%- endif %}
{%- endfor %}
{%- endfor %}
5 changes: 4 additions & 1 deletion ufw/config/interfaces.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
{%- set sls_reload_service = tplroot ~ '.service.reload' %}
{%- from tplroot ~ "/map.jinja" import ufw with context %}
{%- set enabled = ufw.get('enabled', False) %}
include:
- {{ sls_package_install }}
- {{ sls_enable_service }}
Expand All @@ -23,7 +25,8 @@ ufw-interface-{{ interface_name }}:
{%- if comment is not none %}
- comment: '"{{ comment }}"'
{%- endif %}
{%- if enabled %}
- listen_in:
- cmd: reload-ufw
{%- endif %}
{%- endfor %}
5 changes: 4 additions & 1 deletion ufw/config/open.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
{%- set sls_reload_service = tplroot ~ '.service.reload' %}
{%- from tplroot ~ "/map.jinja" import ufw with context %}
{%- set enabled = ufw.get('enabled', False) %}
include:
- {{ sls_package_install }}
- {{ sls_enable_service }}
Expand All @@ -23,7 +25,8 @@ ufw-open-{{ open_addr }}:
{%- if comment is not none %}
- comment: '"{{ comment }}"'
{%- endif %}
{%- if enabled %}
- listen_in:
- cmd: reload-ufw
{%- endif %}
{%- endfor %}
5 changes: 4 additions & 1 deletion ufw/config/services.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
{%- set sls_reload_service = tplroot ~ '.service.reload' %}
{%- from tplroot ~ "/map.jinja" import ufw with context %}
{%- set enabled = ufw.get('enabled', False) %}
include:
- {{ sls_package_install }}
- {{ sls_enable_service }}
Expand Down Expand Up @@ -49,8 +51,9 @@ ufw-svc-{{ method }}-{{ service_name }}-{{ from_addr }}:
- comment: '"{{ comment }}"'
{%- endif %}
- to_port: "{{ to_port }}"
{%- if enabled %}
- listen_in:
- cmd: reload-ufw
{%- endif %}
{%- endfor %}
{%- endfor %}

0 comments on commit c953630

Please sign in to comment.