From 25778a8da49216e7eb6ec130171e68a2f9e4db7d Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 29 Jan 2022 15:19:47 +0000 Subject: [PATCH] python_requirements_info: don't overwrite results in 'mismatched' dict key (#4078) (#4110) * 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 (cherry picked from commit 526369a2439a1306d6635e98bfe25e18c63db07d) Co-authored-by: Will Hegedus --- 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 d6ed6df0c5..2faca20a00 100644 --- a/plugins/modules/system/python_requirements_info.py +++ b/plugins/modules/system/python_requirements_info.py @@ -153,7 +153,7 @@ def main(): 'desired': dep, } else: - results['mismatched'] = { + results['mismatched'][pkg] = { 'installed': existing, 'desired': dep, }