Merge pull request #21938 from rallytime/bp-21878

Backport #21878 to 2015.2
This commit is contained in:
jfindlay 2015-03-24 10:35:01 -06:00
commit 8977ed20c7

View File

@ -258,7 +258,10 @@ def host_keys(keydir=None):
kname += '.{0}'.format(top[1])
try:
with salt.utils.fopen(os.path.join(keydir, fn_), 'r') as _fh:
keys[kname] = _fh.readline().strip()
# As of RFC 4716 "a key file is a text file, containing a sequence of lines",
# although some SSH implementations (e.g. OpenSSH) manage their own format(s).
# Please see #20708 for a discussion about how to handle SSH key files in the future
keys[kname] = _fh.read.strip()
except (IOError, OSError):
keys[kname] = ''
return keys