Commit 165406cf by BoscoMW

Catch permissions errors related to opening a known_hosts file

Catch permissions errors related to opening a known_hosts file
parent fe88fcb6
...@@ -207,9 +207,15 @@ class Connection(object): ...@@ -207,9 +207,15 @@ class Connection(object):
if not os.path.exists(hf): if not os.path.exists(hf):
hfiles_not_found += 1 hfiles_not_found += 1
continue continue
host_fh = open(hf) try:
data = host_fh.read() host_fh = open(hf)
host_fh.close() except IOError, e:
hfiles_not_found += 1
continue
else
data = host_fh.read()
host_fh.close()
for line in data.split("\n"): for line in data.split("\n"):
if line is None or " " not in line: if line is None or " " not in line:
continue continue
......
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