From f09c39b71e84eb15481a9c2b4fd08beabfb17cff Mon Sep 17 00:00:00 2001 From: quidame Date: Sat, 29 May 2021 10:50:24 +0200 Subject: [PATCH] iptables_state: fix broken query of `async_status` result (#2671) * use get() rather than querying the key directly * add a changelog fragment * re-enable CI tests * Update changelog fragment Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- .../2671-fix-broken-query-of-async_status-result.yml | 6 ++++++ plugins/action/system/iptables_state.py | 2 +- tests/integration/targets/iptables_state/aliases | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/2671-fix-broken-query-of-async_status-result.yml diff --git a/changelogs/fragments/2671-fix-broken-query-of-async_status-result.yml b/changelogs/fragments/2671-fix-broken-query-of-async_status-result.yml new file mode 100644 index 0000000000..993caaa323 --- /dev/null +++ b/changelogs/fragments/2671-fix-broken-query-of-async_status-result.yml @@ -0,0 +1,6 @@ +--- +bugfixes: + - "iptables_state - fix a broken query of ``async_status`` result + with current ansible-core development version + (https://github.com/ansible-collections/community.general/issues/2627, + https://github.com/ansible-collections/community.general/pull/2671)." diff --git a/plugins/action/system/iptables_state.py b/plugins/action/system/iptables_state.py index 96b6dc689c..887f3f47f9 100644 --- a/plugins/action/system/iptables_state.py +++ b/plugins/action/system/iptables_state.py @@ -52,7 +52,7 @@ class ActionModule(ActionBase): module_args=module_args, task_vars=task_vars, wrap_async=False) - if async_result['finished'] == 1: + if async_result.get('finished', 0) == 1: break time.sleep(min(1, timeout)) diff --git a/tests/integration/targets/iptables_state/aliases b/tests/integration/targets/iptables_state/aliases index 12765cec47..3cac4af522 100644 --- a/tests/integration/targets/iptables_state/aliases +++ b/tests/integration/targets/iptables_state/aliases @@ -5,4 +5,3 @@ skip/freebsd # no iptables/netfilter (Linux specific) skip/osx # no iptables/netfilter (Linux specific) skip/macos # no iptables/netfilter (Linux specific) skip/aix # no iptables/netfilter (Linux specific) -disabled # FIXME