From 62d31e41e070b3842e41a1de7aa0caa41f6f209e Mon Sep 17 00:00:00 2001 From: liquorice-head <40302350+liquorice-head@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:06:49 +0400 Subject: [PATCH 1/5] Update _api_data.py --- plugins/module_utils/_api_data.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/module_utils/_api_data.py b/plugins/module_utils/_api_data.py index 847f5b13..a026d664 100644 --- a/plugins/module_utils/_api_data.py +++ b/plugins/module_utils/_api_data.py @@ -2984,8 +2984,8 @@ def join_path(path): 'jump-target': KeyInfo(can_disable=True), 'layer7-protocol': KeyInfo(can_disable=True), 'limit': KeyInfo(can_disable=True), - 'log': KeyInfo(can_disable=True), - 'log-prefix': KeyInfo(can_disable=True), + 'log': KeyInfo(default=False), + 'log-prefix': KeyInfo(default=''), 'nth': KeyInfo(can_disable=True), 'out-bridge-port': KeyInfo(can_disable=True), 'out-bridge-port-list': KeyInfo(can_disable=True), @@ -3055,8 +3055,8 @@ def join_path(path): 'jump-target': KeyInfo(can_disable=True), 'layer7-protocol': KeyInfo(can_disable=True), 'limit': KeyInfo(can_disable=True), - 'log': KeyInfo(can_disable=True), - 'log-prefix': KeyInfo(can_disable=True), + 'log': KeyInfo(default=False), + 'log-prefix': KeyInfo(default=''), 'new-connection-mark': KeyInfo(can_disable=True), 'new-dscp': KeyInfo(can_disable=True), 'new-mss': KeyInfo(can_disable=True), @@ -3135,8 +3135,8 @@ def join_path(path): 'jump-target': KeyInfo(can_disable=True), 'layer7-protocol': KeyInfo(can_disable=True), 'limit': KeyInfo(can_disable=True), - 'log': KeyInfo(can_disable=True), - 'log-prefix': KeyInfo(can_disable=True), + 'log': KeyInfo(default=False), + 'log-prefix': KeyInfo(default=''), 'nth': KeyInfo(can_disable=True), 'out-bridge-port': KeyInfo(can_disable=True), 'out-bridge-port-list': KeyInfo(can_disable=True), @@ -3198,8 +3198,8 @@ def join_path(path): 'ipv4-options': KeyInfo(can_disable=True), 'jump-target': KeyInfo(can_disable=True), 'limit': KeyInfo(can_disable=True), - 'log': KeyInfo(can_disable=True), - 'log-prefix': KeyInfo(can_disable=True), + 'log': KeyInfo(default=False), + 'log-prefix': KeyInfo(default=''), 'nth': KeyInfo(can_disable=True), 'out-bridge-port': KeyInfo(can_disable=True), 'out-bridge-port-list': KeyInfo(can_disable=True), From 1920553c4fc1e5678fa9e1cd67097ab36edf1d08 Mon Sep 17 00:00:00 2001 From: liquorice-head <40302350+liquorice-head@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:29:05 +0400 Subject: [PATCH 2/5] Create 324-fix-firewall-log-and-log-prefix.yaml --- changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml diff --git a/changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml b/changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml new file mode 100644 index 00000000..281d63bc --- /dev/null +++ b/changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml @@ -0,0 +1,2 @@ +bugfixes: + - fields 'log' and 'log-prefix' in paths ip firewall filter, mangle, nat, raw changed from KeyInfo(can_disable=True) to KeyInfo(default=False) for 'log' and KeyInfo(default='') for 'log-prefix' (https://github.com/ansible-collections/community.routeros/pull/324). From 1b5374c2c86f7135142c96749d0ae965dd3cdd0e Mon Sep 17 00:00:00 2001 From: liquorice-head <40302350+liquorice-head@users.noreply.github.com> Date: Fri, 1 Nov 2024 11:18:25 +0400 Subject: [PATCH 3/5] Update changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml Co-authored-by: Felix Fontein --- changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml b/changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml index 281d63bc..3c564707 100644 --- a/changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml +++ b/changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml @@ -1,2 +1,2 @@ bugfixes: - - fields 'log' and 'log-prefix' in paths ip firewall filter, mangle, nat, raw changed from KeyInfo(can_disable=True) to KeyInfo(default=False) for 'log' and KeyInfo(default='') for 'log-prefix' (https://github.com/ansible-collections/community.routeros/pull/324). + - api_info, api_modify - fields ``log`` and ``log-prefix`` in paths ``ip firewall filter``, ``ip firewall mangle``, ``ip firewall nat``, ``ip firewall raw`` now have the correct default values (https://github.com/ansible-collections/community.routeros/pull/324). From 1fdc0bd67b539c6354ea331dad92c097a1db4f92 Mon Sep 17 00:00:00 2001 From: liquorice-head <40302350+liquorice-head@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:09:46 +0400 Subject: [PATCH 4/5] Update test_api_info.py --- tests/unit/plugins/modules/test_api_info.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/plugins/modules/test_api_info.py b/tests/unit/plugins/modules/test_api_info.py index 1c9d0141..ae08301a 100644 --- a/tests/unit/plugins/modules/test_api_info.py +++ b/tests/unit/plugins/modules/test_api_info.py @@ -229,8 +229,8 @@ def test_disabled_exclamation(self, mock_compose_api_path): '!jump-target': None, '!layer7-protocol': None, '!limit': None, - '!log': None, - '!log-prefix': None, + '!log': False, + '!log-prefix': '', '!nth': None, '!out-bridge-port': None, '!out-bridge-port-list': None, @@ -318,8 +318,8 @@ def test_disabled_null_value(self, mock_compose_api_path): 'jump-target': None, 'layer7-protocol': None, 'limit': None, - 'log': None, - 'log-prefix': None, + 'log': False, + 'log-prefix': '', 'nth': None, 'out-bridge-port': None, 'out-bridge-port-list': None, From e0145649b9ff7884d04cfc4fd110e537a457dc84 Mon Sep 17 00:00:00 2001 From: alsmirnov Date: Fri, 22 Nov 2024 13:26:42 +0400 Subject: [PATCH 5/5] fix tests --- .../plugins/modules/test_api_find_and_modify.py | 14 ++++++++++++++ tests/unit/plugins/modules/test_api_info.py | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/unit/plugins/modules/test_api_find_and_modify.py b/tests/unit/plugins/modules/test_api_find_and_modify.py index 2f47af4f..e6eb00bc 100644 --- a/tests/unit/plugins/modules/test_api_find_and_modify.py +++ b/tests/unit/plugins/modules/test_api_find_and_modify.py @@ -620,6 +620,8 @@ def test_change_remove_generic(self): 'comment': 'defconf', 'protocol': 'icmp', 'disabled': False, + 'log': False, + 'log-prefix': '', }, { '.id': '*3', @@ -627,6 +629,8 @@ def test_change_remove_generic(self): 'chain': 'input', 'comment': 'defconf', 'disabled': False, + 'log': False, + 'log-prefix': '', }, { '.id': '*4', @@ -634,6 +638,8 @@ def test_change_remove_generic(self): 'chain': 'input', 'comment': 'defconf', 'disabled': False, + 'log': False, + 'log-prefix': '', }, { '.id': '*7', @@ -642,6 +648,8 @@ def test_change_remove_generic(self): 'comment': 'defconf', 'disabled': False, 'in-interface': 'wan', + 'log': False, + 'log-prefix': '', }, { '.id': '*8', @@ -650,6 +658,8 @@ def test_change_remove_generic(self): 'comment': 'defconf', 'connection-state': 'established', 'disabled': False, + 'log': False, + 'log-prefix': '', }, { '.id': '*9', @@ -658,6 +668,8 @@ def test_change_remove_generic(self): 'comment': 'defconf', 'connection-state': 'related', 'disabled': False, + 'log': False, + 'log-prefix': '', }, { '.id': '*A', @@ -666,6 +678,8 @@ def test_change_remove_generic(self): 'comment': 'defconf', 'connection-status': 'invalid', 'disabled': False, + 'log': False, + 'log-prefix': '', }, ]) self.assertEqual(result['match_count'], 3) diff --git a/tests/unit/plugins/modules/test_api_info.py b/tests/unit/plugins/modules/test_api_info.py index ae08301a..1c9d0141 100644 --- a/tests/unit/plugins/modules/test_api_info.py +++ b/tests/unit/plugins/modules/test_api_info.py @@ -229,8 +229,8 @@ def test_disabled_exclamation(self, mock_compose_api_path): '!jump-target': None, '!layer7-protocol': None, '!limit': None, - '!log': False, - '!log-prefix': '', + '!log': None, + '!log-prefix': None, '!nth': None, '!out-bridge-port': None, '!out-bridge-port-list': None, @@ -318,8 +318,8 @@ def test_disabled_null_value(self, mock_compose_api_path): 'jump-target': None, 'layer7-protocol': None, 'limit': None, - 'log': False, - 'log-prefix': '', + 'log': None, + 'log-prefix': None, 'nth': None, 'out-bridge-port': None, 'out-bridge-port-list': None,