#NEWLINE# def delete_key( self , match = None , match_dict = None , preserve_minions = False , revoke_auth = False ) : #NEWLINE# #INDENT# '\n        Delete public keys. If "match" is passed, it is evaluated as a glob.\n        Pre-gathered matches can also be passed via "match_dict".\n        ' #NEWLINE# if ( match is not None ) : #NEWLINE# #INDENT# matches = self . name_match ( match ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( match_dict is not None ) and isinstance ( match_dict , dict ) ) : #NEWLINE# #INDENT# matches = match_dict #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# matches = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# for ( status , keys ) in six . iteritems ( matches ) : #NEWLINE# #INDENT# for key in keys : #NEWLINE# #INDENT# if revoke_auth : #NEWLINE# #INDENT# if ( self . opts . get ( 'rotate_aes_key' ) is False ) : #NEWLINE# #INDENT# print ( 'Immediate auth revocation specified but AES key rotation not allowed. Minion will not be disconnected until the master AES key is rotated.' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# client = salt . client . get_local_client ( mopts = self . opts ) #NEWLINE# client . cmd ( key , 'saltutil.revoke_auth' ) #NEWLINE# #UNINDENT# except salt . exceptions . SaltClientError : #NEWLINE# #INDENT# print ( "Cannot contact Salt master. Connection for {0} will remain up until master AES key is rotated or auth is revoked with 'saltutil.revoke_auth'." . format ( key ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# os . remove ( os . path . join ( self . opts [ 'pki_dir' ] , status , key ) ) #NEWLINE# #UNINDENT# except ( OSError , IOError ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . check_minion_cache ( preserve_minions = matches . get ( 'minions' , [ ] ) ) #NEWLINE# return ( self . name_match ( match ) if ( match is not None ) else self . dict_match ( matches ) )