This should fix #67 in that it should be much more obvious why a server is unknown: to wit, a key is being ignored.
I wasn't sure how to pass log information from client or transport to hostkeys so I just called out to util.get_logger again. If you have a better way in mind, please let me know and I'll try to implement it.
I'd change this to be something like:
"Not enough fields found in known_hosts in line %r" % line
Slightly clearer, also just uses repr to display the string.
(If we can get the line number at this point, that'd also be great to add.)
"Unable to handle key of type %s" % keytype
Thanks for this!
I'll merge once those changes are in. Thanks again!
Hi, I understand the language changes, but which changes are the PEP8 ones? Unwrapping one-element tuples?
I can easily add lineno to from_line and use that to pass the line number information for logging purposes. There's only one caller of from_line, so that should be fine. Is that OK?
Warn on parse failure when reading known_hosts
Ah, I think I see -- spacing around the % operator. I'm leaving the one-element tuple (PEP8 is silent on that ;) ) and pushing --force onto this branch. Thanks for the review!
Yes, it was mostly the spacing. I personally think one-item tuples in interpolation is ugly and prefer only to use it when required for disambiguating things, but won't fight over it. Also, no worries on the line number thing, that works for me. Thanks again!
N.B. even with my personal, pretty boring known_hosts, I was seeing No logger defined for paramiko.hostkeys once this change landed, because I had some line in my file that was slightly off (and because the logging module default is to spew WARN and above).
No logger defined for paramiko.hostkeys
I think it should probably be an info, not a warning, or lots of folks are going to start seeing this in their previously "working fine" setups and wonder what's up. It's still logged, and so will still be visible to somebody explicitly troubleshooting their known_hosts file, IMO.
Making that change myself now.
Flip bad known_hosts line to INFO from WARN re #153