@ -560,22 +560,21 @@ class Facts(object):
def get_public_ssh_host_keys ( self ) :
def get_public_ssh_host_keys ( self ) :
keytypes = ( ' dsa ' , ' rsa ' , ' ecdsa ' , ' ed25519 ' )
keytypes = ( ' dsa ' , ' rsa ' , ' ecdsa ' , ' ed25519 ' )
if self . facts [ ' system ' ] == ' Darwin ' :
# list of directories to check for ssh keys
if self . facts [ ' distribution ' ] == ' MacOSX ' and LooseVersion ( self . facts [ ' distribution_version ' ] ) > = LooseVersion ( ' 10.11 ' ) :
# used in the order listed here, the first one with keys is used
keydir = ' /etc/ssh '
keydirs = [ ' /etc/ssh ' , ' /etc/openssh ' , ' /etc ' ]
else :
keydir = ' /etc '
if self . facts [ ' distribution ' ] == ' Altlinux ' :
keydir = ' /etc/openssh '
else :
keydir = ' /etc/ssh '
for type_ in keytypes :
for keydir in keydirs :
key_filename = ' %s /ssh_host_ %s _key.pub ' % ( keydir , type_ )
for type_ in keytypes :
keydata = get_file_content ( key_filename )
if keydata is not None :
factname = ' ssh_host_key_ %s _public ' % type_
factname = ' ssh_host_key_ %s _public ' % type_
self . facts [ factname ] = keydata . split ( ) [ 1 ]
if factname in self . facts :
# a previous keydir was already successful, stop looking
# for keys
return
key_filename = ' %s /ssh_host_ %s _key.pub ' % ( keydir , type_ )
keydata = get_file_content ( key_filename )
if keydata is not None :
self . facts [ factname ] = keydata . split ( ) [ 1 ]
def get_pkg_mgr_facts ( self ) :
def get_pkg_mgr_facts ( self ) :
self . facts [ ' pkg_mgr ' ] = ' unknown '
self . facts [ ' pkg_mgr ' ] = ' unknown '