#NEWLINE# @ click . command ( ) #NEWLINE# @ click . argument ( 'label' ) #NEWLINE# @ click . option ( '--in-file' , '-f' , type = click . Path ( exists = True ) , help = 'The id_rsa.pub file to import for this key' ) #NEWLINE# @ click . option ( '--key' , '-k' , help = 'The actual SSH key' ) #NEWLINE# @ click . option ( '--note' , help = 'Extra note that will be associated with key' ) #NEWLINE# @ environment . pass_env #NEWLINE# def cli( env , label , in_file , key , note ) : #NEWLINE# #INDENT# 'Add a new SSH key.' #NEWLINE# if key : #NEWLINE# #INDENT# key_text = mgr #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# key_file = open ( path . expanduser ( in_file ) , 'rU' ) #NEWLINE# key_text = key_file . read ( ) . strip ( ) #NEWLINE# key_file . close ( ) #NEWLINE# #UNINDENT# mgr = SoftLayer . SshKeyManager ( env . client ) #NEWLINE# result = mgr . add_key ( key_text , label , note ) #NEWLINE# env . fout ( ( 'SSH key added: %s' % result . get ( 'fingerprint' ) ) )