Soft import of paramiko since we have the SSH and local connection types now. Packaging will still
require it.
This commit is contained in:
parent
a765deccce
commit
cf313cde96
1 changed files with 10 additions and 1 deletions
|
@ -32,9 +32,14 @@ import random
|
||||||
from ansible import errors
|
from ansible import errors
|
||||||
# prevent paramiko warning noise
|
# prevent paramiko warning noise
|
||||||
# see http://stackoverflow.com/questions/3920502/
|
# see http://stackoverflow.com/questions/3920502/
|
||||||
|
HAVE_PARAMIKO=False
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("ignore")
|
warnings.simplefilter("ignore")
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAVE_PARAMIKO=True
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
class ParamikoConnection(object):
|
class ParamikoConnection(object):
|
||||||
''' SSH based connections with Paramiko '''
|
''' SSH based connections with Paramiko '''
|
||||||
|
@ -48,6 +53,10 @@ class ParamikoConnection(object):
|
||||||
self.port = self.runner.remote_port
|
self.port = self.runner.remote_port
|
||||||
|
|
||||||
def _get_conn(self):
|
def _get_conn(self):
|
||||||
|
|
||||||
|
if not HAVE_PARAMIKO:
|
||||||
|
raise errors.AnsibleError("paramiko is not installed")
|
||||||
|
|
||||||
user = self.runner.remote_user
|
user = self.runner.remote_user
|
||||||
|
|
||||||
ssh = paramiko.SSHClient()
|
ssh = paramiko.SSHClient()
|
||||||
|
|
Loading…
Reference in a new issue