Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #4964/e2426707 backport][stable-5] Fix keyring_info when using keyring library #4991

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Jul 24, 2022

This is a backport of PR #4964 as merged into main (e242670).

SUMMARY

The docs say this module works with the keyring library, but actually this line was clobbering any passphrase retrieved from that library, making it useless on any system without the alternate method (gnome-keyring).

After this change, it'll only use the alternate method if the first one didn't work, so the return value from the first one will actually get passed through.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

keyring_info

ADDITIONAL INFORMATION

Reproduction:

# tested on macOS

- name: Save a password to the keychain
  community.general.keyring:
    service: example-service
    username: example-user
    password: example-password
    keyring_password: ""

- name: Read it back from the keychain
  community.general.keyring_info:
    service: example-service
    username: example-user
    keyring_password: ""
  register: example_result

- debug:
    msg: "{{ example_result }}"

before the change

ok: [localhost] => 
    msg:
        changed: false
        failed: false
        msg: Password for example-service@example-user does not exist.

after the change

ok: [localhost] => 
    msg:
        changed: false
        failed: false
        msg: Successfully retrieved password for example-service@example-user
        passphrase: example-password

* 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 <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e242670)
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added backport bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor plugins plugin (any type) system labels Jul 24, 2022
@felixfontein felixfontein merged commit 29e7fae into stable-5 Jul 24, 2022
@felixfontein felixfontein deleted the patchback/backports/stable-5/e2426707e2c38b5c106f000d66bc76a46ab5cd03/pr-4964 branch July 24, 2022 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor plugins plugin (any type) system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants