Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pyinfra/connectors: Fix overwriting of users known_hosts file (pyinfr…
…a-dev#1209) This fixes issue pyinfra-dev#1209, making it so that we append new keys to the users known_hosts file instead of overwriting it. Additionally: Added a testcase that should discover this breaking in the future. Broke out the append functionality into a "append_hostkey" function, making it so we don't needlessly reuse code for AskPolicy and AcceptNewPolicy. Linting actually correct this time. Previous behaviour when adding a new key: Create a paramiko.HostKeys object Read the users known_hosts file Add the new key to the object Save the object, overwriting the users host_keys file. New behaviour: Create a paramiko.HostKeyEntry object using the new hostname and corresponding key. Append this key to the existing known_hosts file.
- Loading branch information