#NEWLINE# def add( self , hostname , key , hash_hostname = False ) : #NEWLINE# #INDENT# '\n        Add a host key entry to the table.  Any existing entries for\n        ``hostname`` pair will be preserved.  Deletion or replacement\n        is not implemented, but _lines entries can be flagged for\n        deletion by setting entry to None.\n        ' #NEWLINE# with _lock : #NEWLINE# #INDENT# lineno = len ( self . _lines ) #NEWLINE# keyval = key . get_base64 ( ) #NEWLINE# keytype = key . get_name ( ) #NEWLINE# if ( hash_hostname or hostname . startswith ( '|' ) ) : #NEWLINE# #INDENT# if ( not hostname . startswith ( '|' ) ) : #NEWLINE# #INDENT# self . _index [ hostname ] . append ( lineno ) #NEWLINE# hostname = paramiko . HostKeys . hash_host ( hostname ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _hashed_hosts . append ( ( hostname , lineno ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . _index [ hostname ] . append ( lineno ) #NEWLINE# #UNINDENT# self . _lines . append ( ( '%s %s %s' % ( hostname , keytype , keyval ) ) ) #NEWLINE# if self . _filename : #NEWLINE# #INDENT# self . save ( ) #NEWLINE# #UNINDENT# #UNINDENT# logging . getLogger ( 'radssh.keys' ) . info ( ( 'Added new known_hosts entry for %s (%s) to %s' % ( hostname , printable_fingerprint ( key ) , self . _filename ) ) ) #NEWLINE# return HostKeyEntry ( [ hostname ] , key , lineno = lineno )