From 526369a2439a1306d6635e98bfe25e18c63db07d Mon Sep 17 00:00:00 2001 From: Will Hegedus Date: Sat, 29 Jan 2022 09:30:07 -0500 Subject: [PATCH] python_requirements_info: don't overwrite results in 'mismatched' dict key (#4078) * bugfix: don't overwrite results in 'mismatched' Whichever mismatched package is evaluated last is the value stored in the 'mismatched' key. Instead, it should have a subdict for each pkg that is mismatched to keep in line with its documented usage. * Update changelogs/fragments/4078-python_requirements_info.yaml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/4078-python_requirements_info.yaml | 2 ++ plugins/modules/system/python_requirements_info.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/4078-python_requirements_info.yaml diff --git a/changelogs/fragments/4078-python_requirements_info.yaml b/changelogs/fragments/4078-python_requirements_info.yaml new file mode 100644 index 0000000000..db6aa8ab77 --- /dev/null +++ b/changelogs/fragments/4078-python_requirements_info.yaml @@ -0,0 +1,2 @@ +bugfixes: + - python_requirements_info - store ``mismatched`` return values per package as documented in the module (https://github.com/ansible-collections/community.general/pull/4078). \ No newline at end of file diff --git a/plugins/modules/system/python_requirements_info.py b/plugins/modules/system/python_requirements_info.py index 76be56850d..dc0e0a44cc 100644 --- a/plugins/modules/system/python_requirements_info.py +++ b/plugins/modules/system/python_requirements_info.py @@ -193,7 +193,7 @@ def main(): 'desired': dep, } else: - results['mismatched'] = { + results['mismatched'][pkg] = { 'installed': existing, 'desired': dep, }