Prevent bug in 'ufw --dry-run reset' to delete firewall rules.
This commit is contained in:
parent
0093b69935
commit
c3271befda
2 changed files with 4 additions and 0 deletions
2
changelogs/fragments/ufw-reset-check-mode.yaml
Normal file
2
changelogs/fragments/ufw-reset-check-mode.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "ufw - when using ``state: reset`` in check mode, ``ufw --dry-run reset`` was executed, which causes a loss of firewall rules. The ``ufw`` module was adjusted to no longer run ``ufw --dry-run reset`` to prevent this from happening."
|
|
@ -301,6 +301,8 @@ def main():
|
|||
cmd = [[ufw_bin], [module.check_mode, '--dry-run']]
|
||||
|
||||
if command == 'state':
|
||||
if value == 'reset' and module.check_mode:
|
||||
continue
|
||||
states = {'enabled': 'enable', 'disabled': 'disable',
|
||||
'reloaded': 'reload', 'reset': 'reset'}
|
||||
execute(cmd + [['-f'], [states[value]]])
|
||||
|
|
Loading…
Reference in a new issue