Paramiko might not come standard everywhere (#54486)

* Paramiko might not come standard everywhere

There is a platform where paramiko isn't shipped but a special version
of paramiko just for our use is shipped.  This code imports paramiko
from that location.
pull/54741/head
Toshio Kuratomi 6 years ago committed by GitHub
parent 48c7501768
commit b03c16fa8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -216,11 +216,14 @@ try:
except ImportError:
HAS_B64 = False
HAS_PARAMIKO = True
try:
import paramiko
HAS_PARAMIKO = True
except ImportError:
HAS_PARAMIKO = False
try:
import ansible_paramiko as paramiko
except ImportError:
HAS_PARAMIKO = False
class PublicKeyManager(object):

@ -165,11 +165,14 @@ from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_arg
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native, to_text, to_bytes
HAS_PARAMIKO = True
try:
import paramiko
HAS_PARAMIKO = True
except ImportError:
HAS_PARAMIKO = False
try:
import ansible_paramiko as paramiko
except ImportError:
HAS_PARAMIKO = False
try:
from scp import SCPClient

@ -86,11 +86,14 @@ from ansible.module_utils.basic import AnsibleModule
import time
import sys
HAS_LIB = True
try:
import paramiko
HAS_LIB = True
except ImportError:
HAS_LIB = False
try:
import ansible_paramiko as paramiko
except ImportError:
HAS_LIB = False
_PROMPTBUFF = 4096

@ -91,11 +91,15 @@ from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
import time
HAS_LIB = True
try:
import paramiko
HAS_LIB = True
except ImportError:
HAS_LIB = False
try:
import ansible_paramiko as paramiko
except ImportError:
HAS_LIB = False
_PROMPTBUFF = 4096

@ -176,7 +176,13 @@ with warnings.catch_warnings():
try:
import paramiko
HAVE_PARAMIKO = True
except (ImportError, AttributeError) as err: # paramiko and gssapi are incompatible and raise AttributeError not ImportError
except ImportError:
try:
import ansible_paramiko as paramiko
HAVE_PARAMIKO = True
except (ImportError, AttributeError) as err: # paramiko and gssapi are incompatible and raise AttributeError not ImportError
PARAMIKO_IMP_ERR = err
except AttributeError as err: # paramiko and gssapi are incompatible and raise AttributeError not ImportError
PARAMIKO_IMP_ERR = err

Loading…
Cancel
Save