mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-30 14:21:26 -07:00
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.
This commit is contained in:
parent
48c7501768
commit
b03c16fa8b
5 changed files with 28 additions and 9 deletions
|
@ -216,10 +216,13 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_B64 = False
|
HAS_B64 = False
|
||||||
|
|
||||||
|
HAS_PARAMIKO = True
|
||||||
try:
|
try:
|
||||||
import paramiko
|
import paramiko
|
||||||
HAS_PARAMIKO = True
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
try:
|
||||||
|
import ansible_paramiko as paramiko
|
||||||
|
except ImportError:
|
||||||
HAS_PARAMIKO = False
|
HAS_PARAMIKO = False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -165,10 +165,13 @@ from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_arg
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils._text import to_native, to_text, to_bytes
|
from ansible.module_utils._text import to_native, to_text, to_bytes
|
||||||
|
|
||||||
|
HAS_PARAMIKO = True
|
||||||
try:
|
try:
|
||||||
import paramiko
|
import paramiko
|
||||||
HAS_PARAMIKO = True
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
try:
|
||||||
|
import ansible_paramiko as paramiko
|
||||||
|
except ImportError:
|
||||||
HAS_PARAMIKO = False
|
HAS_PARAMIKO = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -86,10 +86,13 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
HAS_LIB = True
|
||||||
try:
|
try:
|
||||||
import paramiko
|
import paramiko
|
||||||
HAS_LIB = True
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
try:
|
||||||
|
import ansible_paramiko as paramiko
|
||||||
|
except ImportError:
|
||||||
HAS_LIB = False
|
HAS_LIB = False
|
||||||
|
|
||||||
_PROMPTBUFF = 4096
|
_PROMPTBUFF = 4096
|
||||||
|
|
|
@ -91,12 +91,16 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
HAS_LIB = True
|
||||||
try:
|
try:
|
||||||
import paramiko
|
import paramiko
|
||||||
HAS_LIB = True
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
try:
|
||||||
|
import ansible_paramiko as paramiko
|
||||||
|
except ImportError:
|
||||||
HAS_LIB = False
|
HAS_LIB = False
|
||||||
|
|
||||||
|
|
||||||
_PROMPTBUFF = 4096
|
_PROMPTBUFF = 4096
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -176,8 +176,14 @@ with warnings.catch_warnings():
|
||||||
try:
|
try:
|
||||||
import paramiko
|
import paramiko
|
||||||
HAVE_PARAMIKO = True
|
HAVE_PARAMIKO = True
|
||||||
|
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
|
except (ImportError, AttributeError) as err: # paramiko and gssapi are incompatible and raise AttributeError not ImportError
|
||||||
PARAMIKO_IMP_ERR = err
|
PARAMIKO_IMP_ERR = err
|
||||||
|
except AttributeError as err: # paramiko and gssapi are incompatible and raise AttributeError not ImportError
|
||||||
|
PARAMIKO_IMP_ERR = err
|
||||||
|
|
||||||
|
|
||||||
class MyAddPolicy(object):
|
class MyAddPolicy(object):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue