Ver código fonte

Adds "Rule inserted" validation

tags/v0.2.0
Rob Ruana 6 anos atrás
pai
commit
dd1c4b34a5
1 arquivos alterados com 6 adições e 0 exclusões
  1. +6
    -0
      _states/ufw.py

+ 6
- 0
_states/ufw.py Ver arquivo

@@ -100,6 +100,7 @@ def _add_rule(method, name, app=None, interface=None, protocol=None,
return _error(name, e.message)

adds = False
inserts = False
updates = False
for line in out.split('\n'):
if re.match('^Skipping', line):
@@ -108,6 +109,9 @@ def _add_rule(method, name, app=None, interface=None, protocol=None,
if re.match('^Rule(s)? added', line):
adds = True
break
if re.match('^Rule(s)? inserted', line):
inserts = True
break
if re.match('^Rule(s)? updated', line):
updates = True
break
@@ -122,6 +126,8 @@ def _add_rule(method, name, app=None, interface=None, protocol=None,

if adds:
return _changed(name, "{0} added".format(name), rule=rule)
elif inserts:
return _changed(name, "{0} inserted".format(name), rule=rule)
elif updates:
return _changed(name, "{0} updated".format(name), rule=rule)
else:

Carregando…
Cancelar
Salvar