#NEWLINE# def status( self , minion_id , pub , verify ) : #NEWLINE# #INDENT# '\n        Accepts the minion id, device id, curve public and verify keys.\n        If the key is not present, put it in pending and return "pending",\n        If the key has been accepted return "accepted"\n        if the key should be rejected, return "rejected"\n        ' #NEWLINE# ( acc , pre , rej ) = self . _check_minions_directories ( ) #NEWLINE# acc_path = os . path . join ( acc , minion_id ) #NEWLINE# pre_path = os . path . join ( pre , minion_id ) #NEWLINE# rej_path = os . path . join ( rej , minion_id ) #NEWLINE# keydata = { #NEWLINE# #INDENT# 'minion_id' : minion_id , #NEWLINE# 'pub' : pub , #NEWLINE# 'verify' : verify , #NEWLINE# #UNINDENT# } #NEWLINE# if self . opts [ 'open_mode' ] : #NEWLINE# #INDENT# with salt . utils . fopen ( acc_path , 'w+b' ) as fp_ : #NEWLINE# #INDENT# fp_ . write ( self . serial . dumps ( keydata ) ) #NEWLINE# return self . ACC #NEWLINE# #UNINDENT# #UNINDENT# if os . path . isfile ( rej_path ) : #NEWLINE# #INDENT# log . debug ( 'Rejection Reason: Keys already rejected.\n' ) #NEWLINE# return self . REJ #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if os . path . isfile ( acc_path ) : #NEWLINE# #INDENT# with salt . utils . fopen ( acc_path , 'rb' ) as fp_ : #NEWLINE# #INDENT# keydata = self . serial . loads ( fp_ . read ( ) ) #NEWLINE# #UNINDENT# if ( ( keydata [ 'pub' ] == pub ) and ( keydata [ 'verify' ] == verify ) ) : #NEWLINE# #INDENT# return self . ACC #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . debug ( 'Rejection Reason: Keys not match prior accepted.\n' ) #NEWLINE# return self . REJ #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if os . path . isfile ( pre_path ) : #NEWLINE# #INDENT# auto_reject = self . auto_key . check_autoreject ( minion_id ) #NEWLINE# auto_sign = self . auto_key . check_autosign ( minion_id ) #NEWLINE# with salt . utils . fopen ( pre_path , 'rb' ) as fp_ : #NEWLINE# #INDENT# keydata = self . serial . loads ( fp_ . read ( ) ) #NEWLINE# #UNINDENT# if ( ( keydata [ 'pub' ] == pub ) and ( keydata [ 'verify' ] == verify ) ) : #NEWLINE# #INDENT# if auto_reject : #NEWLINE# #INDENT# self . reject ( minion_id ) #NEWLINE# log . debug ( 'Rejection Reason: Auto reject pended.\n' ) #NEWLINE# return self . REJ #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if auto_sign : #NEWLINE# #INDENT# self . accept ( minion_id ) #NEWLINE# return self . ACC #NEWLINE# #UNINDENT# #UNINDENT# return self . PEND #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . debug ( 'Rejection Reason: Keys not match prior pended.\n' ) #NEWLINE# return self . REJ #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# auto_reject = self . auto_key . check_autoreject ( minion_id ) #NEWLINE# auto_sign = self . auto_key . check_autosign ( minion_id ) #NEWLINE# if self . opts [ 'auto_accept' ] : #NEWLINE# #INDENT# w_path = acc_path #NEWLINE# ret = self . ACC #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if auto_sign : #NEWLINE# #INDENT# w_path = acc_path #NEWLINE# ret = self . ACC #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if auto_reject : #NEWLINE# #INDENT# w_path = rej_path #NEWLINE# log . debug ( 'Rejection Reason: Auto reject new.\n' ) #NEWLINE# ret = self . REJ #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# w_path = pre_path #NEWLINE# ret = self . PEND #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# with salt . utils . fopen ( w_path , 'w+b' ) as fp_ : #NEWLINE# #INDENT# fp_ . write ( self . serial . dumps ( keydata ) ) #NEWLINE# return ret