fix id_dsa check error

This commit is contained in:
倪建强
2017-05-26 09:47:52 +08:00
parent dd6c82b168
commit b36b702705

View File

@@ -180,15 +180,14 @@ def timesince(dt, since='', default="just now"):
def ssh_key_string_to_obj(text):
key_f = StringIO(text)
key = None
try:
key = paramiko.RSAKey.from_private_key(key_f)
key = paramiko.RSAKey.from_private_key( StringIO(text) )
except paramiko.SSHException:
pass
try:
key = paramiko.DSSKey.from_private_key(key_f)
key = paramiko.DSSKey.from_private_key( StringIO(text) )
except paramiko.SSHException:
pass
return key