Append key to entries directly

pull/12/head
Sheng 2018-04-10 11:15:58 +08:00
parent 024612599b
commit 3de544da80
1 changed files with 3 additions and 1 deletions

View File

@ -56,7 +56,9 @@ class AutoAddPolicy(paramiko.client.MissingHostKeyPolicy):
logging.info(
'Adding {} host key for {}'.format(keytype, hostname)
)
client._host_keys.add(hostname, keytype, key)
client._host_keys._entries.append(
paramiko.hostkeys.HostKeyEntry([hostname], key)
)
with open(client._host_keys_filename, 'a') as f:
f.write('{} {} {}\n'.format(