def accept_key(pki_dir, pub, id_):
 for key_dir in ('minions', 'minions_pre', 'minions_rejected'):
  key_path = os.path.join(pki_dir, key_dir)
  if (not os.path.exists(key_path)):
   os.makedirs(key_path)
 key = os.path.join(pki_dir, 'minions', id_)
 with salt.utils.fopen(key, 'w+') as fp_:
  fp_.write(pub)
 oldkey = os.path.join(pki_dir, 'minions_pre', id_)
 if os.path.isfile(oldkey):
  with salt.utils.fopen(oldkey) as fp_:
   if (fp_.read() == pub):
    os.remove(oldkey)

def accept_key ( pki_dir , pub , id_ ) : for key_dir in ( 'minions' , 'minions_pre' , 'minions_rejected' ) : key_path = os . path . join ( pki_dir , key_dir ) if ( not os . path . exists ( key_path ) ) : os . makedirs ( key_path ) key = os . path . join ( pki_dir , 'minions' , id_ ) with salt . utils . fopen ( key , 'w+' ) as fp_ : fp_ . write ( pub ) oldkey = os . path . join ( pki_dir , 'minions_pre' , id_ ) if os . path . isfile ( oldkey ) : with salt . utils . fopen ( oldkey ) as fp_ : if ( fp_ . read ( ) == pub ) : os . remove ( oldkey )
if the master config was available then we will have a pki_dir key in the opts directory .