#NEWLINE# def import_rsa_token( self , name , url , token ) : #NEWLINE# #INDENT# folder = tempfile . mkdtemp ( ) #NEWLINE# fn = os . path . join ( folder , 'stokenrs' ) #NEWLINE# rv = Popen ( [ 'stoken' , 'import' , ( '--token=%s' % token ) , '--rcfile' , fn , '--new-password=' ] ) . wait ( ) #NEWLINE# try : #NEWLINE# #INDENT# if ( rv != 0 ) : #NEWLINE# #INDENT# raise click . UsageError ( 'Could not import token' ) #NEWLINE# #UNINDENT# with open ( fn ) as f : #NEWLINE# #INDENT# token = _token_re . search ( f . read ( ) ) . group ( 1 ) #NEWLINE# #UNINDENT# self . set_keychain_password ( self , url , '' , token , kind = 'openconnect-rsa' ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# shutil . rmtree ( folder ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# pass