def gethostconfig(self, file, host):
import paramiko
file = os.path.expanduser(file)
if not os.path.isfile(file):
return {}
sshconfig = paramiko.SSHConfig()
try:
sshconfig.parse(open(file))
except Exception as e:
raise BackendException("could not load '%s', maybe corrupt?" % (file))
return sshconfig.lookup(host)
评论列表
文章目录