Commit e418ebf4 authored by ibuler's avatar ibuler

Merge branch 'bugfix_sftp' into dev

parents d7b0dd1e d219cffa
......@@ -22,11 +22,24 @@ class SSHConnection:
def app(self):
return self._app()
def get_system_user_auth(self, system_user):
"""
获取系统用户的认证信息,密码或秘钥
:return: system user have full info
"""
password, private_key = \
self.app.service.get_system_user_auth_info(system_user)
system_user.password = password
system_user.private_key = private_key
def get_ssh_client(self, asset, system_user):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
sock = None
if not system_user.password and not system_user.private_key:
self.get_system_user_auth(system_user)
if asset.domain:
sock = self.get_proxy_sock(asset)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment