Skip to content

Add HostKeys.clear_host - #944

Open
Gerardwx wants to merge 2 commits into
paramiko:mainfrom
Gerardwx:master
Open

Gerardwx wants to merge 2 commits into
paramiko:mainfrom
Gerardwx:master

Conversation

@Gerardwx

@Gerardwx Gerardwx commented Apr 23, 2017 •

Copy link
Copy Markdown

I needed a method to clear an existing host in a known_host file, so I added one. (Equivalent of ssh-keygen -f filename -R hostname)

@coveralls

coveralls commented Apr 23, 2017 •

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 79a4d4d on Gerardwx:master into ** on paramiko:master**.

@bitprophet

Copy link
Copy Markdown
Member

Thanks, looks good at a glance! Notes mostly to myself for merge time:

  • Surely we have a subroutine for the if h.startswith('|1|') + constant_time_bytes_eq, "is it a hashed entry" snippet by now? If not we should make one because I'm sure this is floating around in a few places...
  • Not sure if clear_host is the best possible name for this, wondering if remove_host or delete_host (maybe even just remove or delete, since it's a HostKeys object the subject being a host should be kind of implicit...).

@bitprophet bitprophet added this to the 2.2 milestone Apr 24, 2017
@Gerardwx

Copy link
Copy Markdown
Author

Changing method name makes total sense. Should we (I) just implement delitem ? It's currently not doing anything:
def __delitem__(self, key):
... k = self[key]

@bitprophet

Copy link
Copy Markdown
Member

That occurred to me too but I was too busy to doublecheck just how dict-like the object currently is. If it's expected to be used as a dict-like object then that may be the best approach, yea. Feel free to take a swing at that if so, and thanks!

@bitprophet bitprophet modified the milestones: 2.2, 2.4.0 Aug 16, 2017
@bitprophet bitprophet modified the milestones: p0, p2 Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants