From 12941f6d9abe41040fe58e2422570cee32472022 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Mon, 16 Aug 2021 13:51:39 +0530 Subject: [PATCH] firewalld: Correct usage of queryForwardPort * Correct queryForwardPort API usage * Enable port_foward_test_cases tests Fixes: #247 Signed-off-by: Abhijeet Kasurde --- changelogs/fragments/247_firewalld.yml | 3 +++ plugins/modules/firewalld.py | 2 +- .../integration/targets/firewalld/tasks/run_all_tests.yml | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/247_firewalld.yml diff --git a/changelogs/fragments/247_firewalld.yml b/changelogs/fragments/247_firewalld.yml new file mode 100644 index 0000000000..2a45b48c03 --- /dev/null +++ b/changelogs/fragments/247_firewalld.yml @@ -0,0 +1,3 @@ +--- +bugfixes: +- firewalld - Correct usage of queryForwardPort (https://github.com/ansible-collections/ansible.posix/issues/247). diff --git a/plugins/modules/firewalld.py b/plugins/modules/firewalld.py index f892cd38c8..95bfe53eab 100644 --- a/plugins/modules/firewalld.py +++ b/plugins/modules/firewalld.py @@ -706,7 +706,7 @@ def get_enabled_immediate(self, port, proto, toport, toaddr, timeout): if self.fw_offline: dummy, fw_settings = self.get_fw_zone_settings() return fw_settings.queryForwardPort(port=port, protocol=proto, to_port=toport, to_addr=toaddr) - return self.fw.queryForwardPort(port=port, protocol=proto, to_port=toport, to_addr=toaddr) + return self.fw.queryForwardPort(zone=self.zone, port=port, protocol=proto, toport=toport, toaddr=toaddr) def get_enabled_permanent(self, port, proto, toport, toaddr, timeout): dummy, fw_settings = self.get_fw_zone_settings() diff --git a/tests/integration/targets/firewalld/tasks/run_all_tests.yml b/tests/integration/targets/firewalld/tasks/run_all_tests.yml index 29d253d776..4270e89650 100644 --- a/tests/integration/targets/firewalld/tasks/run_all_tests.yml +++ b/tests/integration/targets/firewalld/tasks/run_all_tests.yml @@ -14,7 +14,10 @@ - include_tasks: port_test_cases.yml # firewalld source operation test cases -- import_tasks: source_test_cases.yml +- include_tasks: source_test_cases.yml # firewalld zone target operation test cases -- import_tasks: zone_target_test_cases.yml \ No newline at end of file +- include_tasks: zone_target_test_cases.yml + +# firewalld port forwarding operation test cases +- include_tasks: port_forward_test_cases.yml