[stable-2.9] Handle InternalError raised by cryptography when running in FIPS mode (#65477)

Since older versions of paramiko do not require cryptography,
we cannot catch the exact exception from cryptography.

Remove other exceptions since we're catching everything now
(cherry picked from commit d35c1a435b)

Co-authored-by: Sam Doran <sdoran@redhat.com>
pull/66377/head
Sam Doran 5 years ago committed by Matt Clay
parent 003e9fdecd
commit e6db6d0d64

@ -0,0 +1,2 @@
bugfixes:
- paramiko - catch and handle exception to prevent stack trace when running in FIPS mode

@ -10,5 +10,8 @@ PARAMIKO_IMPORT_ERR = None
paramiko = None paramiko = None
try: try:
import paramiko import paramiko
except (ImportError, AttributeError) as err: # paramiko and gssapi are incompatible and raise AttributeError not ImportError # paramiko and gssapi are incompatible and raise AttributeError not ImportError
# When running in FIPS mode, cryptography raises InternalError
# https://bugzilla.redhat.com/show_bug.cgi?id=1778939
except Exception as err:
PARAMIKO_IMPORT_ERR = err PARAMIKO_IMPORT_ERR = err

Loading…
Cancel
Save