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

AnsibleError: Decryption failed #23

Open
mli312 opened this issue Jan 3, 2019 · 2 comments
Open

AnsibleError: Decryption failed #23

mli312 opened this issue Jan 3, 2019 · 2 comments
Assignees

Comments

@mli312
Copy link

mli312 commented Jan 3, 2019

When I run
data = vault.load(open(test).read()) where test = "/path/to/vault.yml"
I get this

---------------------------------------------------------------------------
AnsibleError                              Traceback (most recent call last)
<ipython-input-104-4b5e48176f32> in <module>()
      2 password = get_ansible_password()
      3 vault = ansible_vault.Vault(password)
----> 4 data = vault.load(open(test).read())

~/.pyenv/versions/3.5.1/lib/python3.5/site-packages/ansible_vault/api.py in load(self, stream)
     48     def load_raw(self, stream):
     49         """Read vault stream and return raw data."""
---> 50         return self.vault.decrypt(stream)
     51 
     52     def dump_raw(self, text, stream=None):

~/.pyenv/versions/3.5.1/lib/python3.5/site-packages/ansible/parsing/vault/__init__.py in decrypt(self, vaulttext, filename)
    249     try:
    250         return unhexlify(b_data)
--> 251     except (BinasciiError, TypeError) as exc:
    252         raise AnsibleVaultFormatError('Vault format unhexlify error: %s' % exc)
    253 

AnsibleError: Decryption failed

I tested with variable test in Unicode string and byte string format. They both returned the same error.

@tomoh1r tomoh1r self-assigned this Jan 4, 2019
@bradwood
Copy link

I have the same problem :(
could it be a trailing \n in the password file?

@ronansalmon
Copy link

Ran into this as well, and yes, the trailing \n is the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants