iptables_state: fix race condition between module and its action plugin (#1140) (#1143)

* fix race condition between module and its action plugin

See https://github.com/ansible-collections/community.general/issues/1136.
Also remove irrelevant/unneeded display.v() and display.warning() around
connection reset.

* do not check for cookie if not in async mode

* add changelog fragment

(cherry picked from commit 3bc31f286e)

Co-authored-by: quidame <quidame@poivron.org>
This commit is contained in:
patchback[bot] 2020-10-20 22:46:12 +02:00 committed by GitHub
parent c826a81b40
commit 7da1f3ffea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 5 deletions

View file

@ -551,6 +551,18 @@ def main():
restored_state = state_to_restore
else:
# Let time enough to the plugin to retrieve async status of the module
# in case of bad option type/value and the like.
if _back is not None:
b_starter = to_bytes('%s.starter' % _back, errors='surrogate_or_strict')
while True:
if os.path.exists(b_starter):
os.remove(b_starter)
break
else:
time.sleep(0.01)
continue
(rc, stdout, stderr) = module.run_command(MAINCOMMAND)
if 'Another app is currently holding the xtables lock' in stderr:
module.fail_json(