ufw: fix default (again) (#55004)

This commit is contained in:
Felix Fontein 2019-04-11 00:06:53 +02:00 committed by René Moser
parent 44a07cfe71
commit 7d2e4dd2fd
3 changed files with 17 additions and 24 deletions

View file

@ -471,14 +471,9 @@ def main():
current_default_values["incoming"] = extract.group(1) current_default_values["incoming"] = extract.group(1)
current_default_values["outgoing"] = extract.group(2) current_default_values["outgoing"] = extract.group(2)
current_default_values["routed"] = extract.group(3) current_default_values["routed"] = extract.group(3)
if params['direction'] is None: v = current_default_values[params['direction'] or 'incoming']
for v in current_default_values.values(): if v not in (value, 'disabled'):
if v not in (value, 'disabled'): changed = True
changed = True
else:
v = current_default_values[params['direction']]
if v not in (value, 'disabled'):
changed = True
else: else:
changed = True changed = True
else: else:

View file

@ -6,4 +6,3 @@ skip/docker
needs/root needs/root
destructive destructive
needs/target/setup_epel needs/target/setup_epel
unstable # the test fails when run in the group, but not by itself

View file

@ -108,30 +108,30 @@
default: deny default: deny
direction: incoming direction: incoming
register: default_change_2 register: default_change_2
- name: Default (change all, check mode) - name: Default (change incoming implicitly, check mode)
ufw: ufw:
default: allow default: allow
check_mode: yes check_mode: yes
register: default_change_all_check register: default_change_implicit_check
- name: Default (change all) - name: Default (change incoming implicitly)
ufw: ufw:
default: allow default: allow
register: default_change_all register: default_change_implicit
- name: Get defaults - name: Get defaults
shell: | shell: |
ufw status verbose | grep "^Default:" ufw status verbose | grep "^Default:"
register: ufw_defaults_change_all register: ufw_defaults_change_implicit
environment: environment:
LC_ALL: C LC_ALL: C
- name: Default (change all, idempotent, check mode) - name: Default (change incoming implicitly, idempotent, check mode)
ufw: ufw:
default: allow default: allow
check_mode: yes check_mode: yes
register: default_change_all_idem_check register: default_change_implicit_idem_check
- name: Default (change all, idempotent) - name: Default (change incoming implicitly, idempotent)
ufw: ufw:
default: allow default: allow
register: default_change_all_idem register: default_change_implicit_idem
- assert: - assert:
that: that:
- default_check is changed - default_check is changed
@ -143,9 +143,8 @@
- default_change is changed - default_change is changed
- "'allow (incoming)' in ufw_defaults_change.stdout" - "'allow (incoming)' in ufw_defaults_change.stdout"
- default_change_2 is changed - default_change_2 is changed
- default_change_all_check is changed - default_change_implicit_check is changed
- default_change_all is changed - default_change_implicit is changed
- default_change_all_idem_check is not changed - default_change_implicit_idem_check is not changed
- default_change_all_idem is not changed - default_change_implicit_idem is not changed
- "'allow (incoming)' in ufw_defaults_change_all.stdout" - "'allow (incoming)' in ufw_defaults_change_implicit.stdout"
- "'allow (outgoing)' in ufw_defaults_change_all.stdout"