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

passwordstore: Improve error messages #3759

Closed
1 task done
jplitza opened this issue Nov 19, 2021 · 3 comments · Fixed by #5436
Closed
1 task done

passwordstore: Improve error messages #3759

jplitza opened this issue Nov 19, 2021 · 3 comments · Fixed by #5436
Labels
feature This issue/PR relates to a feature request lookup lookup plugin plugins plugin (any type)

Comments

@jplitza
Copy link
Contributor

jplitza commented Nov 19, 2021

Summary

When using the passwordstore lookup plugin and the execution of pass fails (e.g. because the repository doesn't exist, the GPG key isn't present, ...) the output from Ansible simply is:

{"msg": "An unhandled exception occurred while running the lookup plugin 'pass'. Error was a <class 'ansible.errors.AnsibleError'>, original message: Command '['pass', 'show', 'my/secret']' returned non-zero exit status 1."}

This is quite unhelpful, since the exit codes from pass aren't documented.

Issue Type

Feature Idea

Component Name

passwordstore

Additional Information

- debug:
    var: 'lookup("passwordstore", "my/secret")'

When no password store is present, this should output helpful information, such as

{"msg": "An unhandled exception occured while running the lookup plugin 'pass'. Error was a <class 'ansible.errors.AnsibleError'>, original message: Command '['pass', 'show', 'my/secret']' returned non-zero exit status 1, standard error: "Error: You must run:
pass init your-gpg-id
before you may use the password store.".

This information even is available to the AnsibleError class, because the parent exception is a submodule.CalledProcessError which has a output attribute which is populated by the module.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request lookup lookup plugin plugins plugin (any type) labels Nov 19, 2021
@TheLastProject
Copy link
Contributor

Maybe my old code can be used for this, if the password store module is maintained now: ansible/ansible#47120

(Back then, nobody had merging rights so it was stuck in limbo)

@felixfontein
Copy link
Collaborator

I don't think it's actively maintained, but if someone creates a PR that looks reasonable I'll merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request lookup lookup plugin plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants