commit 3de544da80eead876509dae8c667bad639789f67
parent 024612599bdc634a6add88a2d655365c8ac8b391
Author: Sheng <webmaster0115@gmail.com>
Date: Tue, 10 Apr 2018 11:15:58 +0800
Append key to entries directly
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/main.py b/main.py
@@ -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(