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

Fix exceptions thrown from cryptography import #16723

Merged
merged 1 commit into from
Jul 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/ansible/parsing/vault/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
from binascii import hexlify
from binascii import unhexlify

try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
display = Display()

# Note: Only used for loading obsolete VaultAES files. All files are written
# using the newer VaultAES256 which does not require md5
from hashlib import md5
Expand Down Expand Up @@ -71,10 +77,9 @@
except ImportError:
pass
except Exception as e:
if e.__module__ == 'pkg_resources' and e.__class__.__name__ == 'DistributionNotFound':
pass
else:
raise
display.warning("Optional dependency 'cryptography' raised an exception, falling back to 'Crypto'")
import traceback
traceback.print_exc()

from ansible.compat.six import PY3
from ansible.utils.unicode import to_unicode, to_bytes
Expand Down