Commit bc93732b by James Cammarata

Catch permissions errors related to opening a known_hosts file in modules

Fixes #6644
parent dc658eaa
...@@ -87,9 +87,16 @@ def not_in_host_file(self, host): ...@@ -87,9 +87,16 @@ def not_in_host_file(self, host):
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)
data = host_fh.read() try:
host_fh.close() host_fh = open(hf)
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 line.find(" ") == -1: if line is None or line.find(" ") == -1:
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