From 249b1a92e2c2cdc1cd8786d9972aa58290723067 Mon Sep 17 00:00:00 2001 From: liquorice-head <40302350+liquorice-head@users.noreply.github.com> Date: Sat, 23 Nov 2024 03:19:05 +0400 Subject: [PATCH] Update _api_data.py (#324) * Update _api_data.py * Create 324-fix-firewall-log-and-log-prefix.yaml * Update changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml Co-authored-by: Felix Fontein * Update test_api_info.py * fix tests --------- Co-authored-by: Felix Fontein Co-authored-by: alsmirnov --- .../324-fix-firewall-log-and-log-prefix.yaml | 2 ++ plugins/module_utils/_api_data.py | 16 ++++++++-------- .../plugins/modules/test_api_find_and_modify.py | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) 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..3c564707 --- /dev/null +++ b/changelogs/fragments/324-fix-firewall-log-and-log-prefix.yaml @@ -0,0 +1,2 @@ +bugfixes: + - 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). diff --git a/plugins/module_utils/_api_data.py b/plugins/module_utils/_api_data.py index 929aa195..bf0d3358 100644 --- a/plugins/module_utils/_api_data.py +++ b/plugins/module_utils/_api_data.py @@ -2986,8 +2986,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), @@ -3057,8 +3057,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), @@ -3137,8 +3137,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), @@ -3200,8 +3200,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), 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)