Commit 28603c92 authored by Antoine Catton's avatar Antoine Catton

Avoid having None in known_hosts file.

parent d183095e
...@@ -43,8 +43,9 @@ class KnownHostsFile(dict): ...@@ -43,8 +43,9 @@ class KnownHostsFile(dict):
def _dump(self): def _dump(self):
with open(self._filename, 'w') as keyfile: with open(self._filename, 'w') as keyfile:
for key, value in self.items(): for key, value in self.items():
keyfile.write('%(host)s %(key)s\n' % {'host': key, if key is not None and value is not None:
'key': value}) keyfile.write('%(host)s %(key)s\n' % {'host': key,
'key': value})
def __enter__(self): def __enter__(self):
self._load() self._load()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment