1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Catch permissions errors related to opening a known_hosts file

Catch permissions errors related to opening a known_hosts file
This commit is contained in:
BoscoMW 2014-04-02 13:42:07 +03:00
parent fe88fcb6d2
commit 165406cf35

View file

@ -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
try:
host_fh = open(hf) host_fh = open(hf)
except IOError, e:
hfiles_not_found += 1
continue
else
data = host_fh.read() data = host_fh.read()
host_fh.close() 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