Show filename additionally if missing secrets prevents decryption (#79732)

Fixes #79723
pull/79762/head
Carsten Grohmann 2 years ago committed by GitHub
parent cf50d8131f
commit 6c0559bffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- vault - show filename additionally if missing secrets prevents decryption (https://github.com/ansible/ansible/issues/79723)

@ -658,7 +658,10 @@ class VaultLib:
b_vaulttext = to_bytes(vaulttext, errors='strict', encoding='utf-8') b_vaulttext = to_bytes(vaulttext, errors='strict', encoding='utf-8')
if self.secrets is None: if self.secrets is None:
raise AnsibleVaultError("A vault password must be specified to decrypt data") msg = "A vault password must be specified to decrypt data"
if filename:
msg += " in file %s" % to_native(filename)
raise AnsibleVaultError(msg)
if not is_encrypted(b_vaulttext): if not is_encrypted(b_vaulttext):
msg = "input is not vault encrypted data. " msg = "input is not vault encrypted data. "

Loading…
Cancel
Save