forked from pyinfra-dev/pyinfra
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for pyinfra overwriting hostfiles (pyinfra-dev#1209)
Instead of relying on paramiko to correctly parse the full hostfile, this fix makes it so that we only append new keys to the hostfile rather than overwriting it completely. The old behaviour results in unwanted alterations to the hostfile, such as hostfile entries not parseable by paramiko disappearing without users consent, and comments being removed. I also split out the logic for appending hostkeys into a new function instead of having the code be unnecessarily repeated in multiple places. This makes the MissingHostKeyPolicy children a bit more readable IMO.
- Loading branch information
Showing
1 changed file
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters