From e2426707e2c38b5c106f000d66bc76a46ab5cd03 Mon Sep 17 00:00:00 2001 From: Sargun Vohra Date: Sun, 24 Jul 2022 03:08:12 -0700 Subject: [PATCH] Fix keyring_info when using keyring library (#4964) * Fix keyring_info when using keyring library This line used to always clobber the passphrase retrieved via the `keyring` library, making it useless on everything except gnome-keyring. After this change, it'll only use the alternate method if the default one didn't work. * delete whitespace * add changelog fragment * Update changelogs/fragments/4964-fix-keyring-info.yml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/4964-fix-keyring-info.yml | 2 ++ plugins/modules/system/keyring_info.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/4964-fix-keyring-info.yml diff --git a/changelogs/fragments/4964-fix-keyring-info.yml b/changelogs/fragments/4964-fix-keyring-info.yml new file mode 100644 index 0000000000..b10e8cc7cf --- /dev/null +++ b/changelogs/fragments/4964-fix-keyring-info.yml @@ -0,0 +1,2 @@ +bugfixes: + - "keyring_info - fix the result from the keyring library never getting returned (https://github.com/ansible-collections/community.general/pull/4964)." diff --git a/plugins/modules/system/keyring_info.py b/plugins/modules/system/keyring_info.py index 4d3e5ee995..3630842859 100644 --- a/plugins/modules/system/keyring_info.py +++ b/plugins/modules/system/keyring_info.py @@ -122,7 +122,9 @@ def run_module(): pass except AttributeError: pass - passphrase = _alternate_retrieval_method(module) + + if passphrase is None: + passphrase = _alternate_retrieval_method(module) if passphrase is not None: result["msg"] = "Successfully retrieved password for %s@%s" % (