#NEWLINE# def _user_exists( self , username ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# pwd . getpwnam ( username ) [ 0 ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# home_dir = os . path . join ( '/home' , '{0}' . format ( username ) ) #NEWLINE# auth_key_file = os . path . join ( home_dir , '.ssh' , 'authorized_keys' ) #NEWLINE# if ( not os . path . exists ( home_dir ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( not os . path . exists ( auth_key_file ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# return True