diff options
author | Alex Yang <yangyang1@zte.com.cn> | 2017-12-21 16:06:13 +0800 |
---|---|---|
committer | Alex Yang <yangyang1@zte.com.cn> | 2017-12-22 15:26:00 +0800 |
commit | 652e4dbb90252153e85cee498ccf64c05490814c (patch) | |
tree | caab13a54d89d970ea6fd5112b019f3125365c50 /modules/opnfv/utils | |
parent | bd73235d8f53662f5048e8a2e9e79c343619229d (diff) |
Prepare integration of daisy and dovetail
JARA: DAISY-76
1. add daisy adapter in releng utils and modules
2. add daisy adapter in dovetail jjb script
3. support id_dsa as ssh key
Change-Id: I15a1c0cfcc17ae1fe6b7020f674b8bbbb72f4a7a
Signed-off-by: Alex Yang <yangyang1@zte.com.cn>
Diffstat (limited to 'modules/opnfv/utils')
-rw-r--r-- | modules/opnfv/utils/ssh_utils.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/opnfv/utils/ssh_utils.py b/modules/opnfv/utils/ssh_utils.py index 4c5ff5c1b..175a38078 100644 --- a/modules/opnfv/utils/ssh_utils.py +++ b/modules/opnfv/utils/ssh_utils.py @@ -49,9 +49,11 @@ def get_ssh_client(hostname, client = paramiko.SSHClient() else: client = ProxyHopClient() + proxy_pkey_file = proxy.get('pkey_file', '/root/.ssh/id_rsa') client.configure_jump_host(proxy['ip'], proxy['username'], - proxy['password']) + proxy['password'], + proxy_pkey_file) if client is None: raise Exception('Could not connect to client') @@ -115,6 +117,8 @@ class ProxyHopClient(paramiko.SSHClient): jh_ssh_key='/root/.ssh/id_rsa'): self.proxy_ip = jh_ip self.proxy_ssh_key = jh_ssh_key + self.local_ssh_key = os.path.join(os.getcwd(), + jh_ssh_key.split('/')[-1]) self.proxy_ssh = paramiko.SSHClient() self.proxy_ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) self.proxy_ssh.connect(jh_ip, @@ -138,8 +142,12 @@ class ProxyHopClient(paramiko.SSHClient): self.local_ssh_key) if get_file_res is None: raise Exception('Could\'t fetch SSH key from jump host') - proxy_key = (paramiko.RSAKey - .from_private_key_file(self.local_ssh_key)) + if self.proxy_ssh_key.split('/')[-1] == 'id_dsa': + proxy_key = (paramiko.DSSKey + .from_private_key_file(self.local_ssh_key)) + else: + proxy_key = (paramiko.RSAKey + .from_private_key_file(self.local_ssh_key)) self.proxy_channel = self.proxy_transport.open_channel( "direct-tcpip", |