mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
Don't just raise AnsibleError with the exception message (#49654)
* Don't just raise AnsibleError with the exception message. Fixes #49252 * Add changelog fragment
This commit is contained in:
parent
f7c44aa9c8
commit
c9040d7579
2 changed files with 6 additions and 1 deletions
2
changelogs/fragments/vault-read-error.yml
Normal file
2
changelogs/fragments/vault-read-error.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- vault - Improve error messages encountered when reading vault files (https://github.com/ansible/ansible/issues/49252)
|
|
@ -1030,7 +1030,10 @@ class VaultEditor:
|
||||||
with open(filename, "rb") as fh:
|
with open(filename, "rb") as fh:
|
||||||
data = fh.read()
|
data = fh.read()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise AnsibleError(to_native(e))
|
msg = to_native(e)
|
||||||
|
if not msg:
|
||||||
|
msg = repr(e)
|
||||||
|
raise AnsibleError('Unable to read source file (%s): %s' % (to_native(filename), msg))
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue