Browse Source

update ufw-formula improve reload function

tags/v0.2.0
Niels Abspoel 8 years ago
parent
commit
b3267bd1d6
2 changed files with 12 additions and 2 deletions
  1. +2
    -2
      _modules/ufw.py
  2. +10
    -0
      ufw/init.sls

+ 2
- 2
_modules/ufw.py View File



def add_rule(rule): def add_rule(rule):
cmd = "ufw " + rule cmd = "ufw " + rule
out = __salt__['cmd.run'](cmd)
__salt__['cmd.run']("ufw reload")
out = __salt__['cmd.run'](cmd, python_shell=True)
# __salt__['cmd.run']("ufw reload") # why reload after adding a rule? :/
return out return out

+ 10
- 0
ufw/init.sls View File

{%- endif %} {%- endif %}
- require: - require:
- pkg: ufw - pkg: ufw
- listen_in:
- cmd: reload-ufw


{%- endfor %} {%- endfor %}
{%- endfor %} {%- endfor %}
- interface: {{interface}} - interface: {{interface}}
- require: - require:
- pkg: ufw - pkg: ufw
- listen_in:
- cmd: reload-ufw


{%- endfor %} {%- endfor %}


- from_addr: {{from_addr}} - from_addr: {{from_addr}}
- require: - require:
- pkg: ufw - pkg: ufw
- listen_in:
- cmd: reload-ufw


{%- endfor %} {%- endfor %}


- require: - require:
- pkg: ufw - pkg: ufw


reload-ufw:
cmd.wait:
- name: ufw reload

disable-logging: disable-logging:
cmd.run: cmd.run:
- name: ufw logging off - name: ufw logging off

Loading…
Cancel
Save