def __singleton_init__(self, opts, io_loop=None):
        '''
        Init an Auth instance

        :param dict opts: Options for this server
        :return: Auth instance
        :rtype: Auth
        '''
        self.opts = opts
        if six.PY2:
            self.token = Crypticle.generate_key_string()
        else:
            self.token = salt.utils.stringutils.to_bytes(Crypticle.generate_key_string())
        self.serial = salt.payload.Serial(self.opts)
        self.pub_path = os.path.join(self.opts['pki_dir'], 'minion.pub')
        self.rsa_path = os.path.join(self.opts['pki_dir'], 'minion.pem')
        if self.opts['__role'] == 'syndic':
            self.mpub = 'syndic_master.pub'
        else:
            self.mpub = 'minion_master.pub'
        if not os.path.isfile(self.pub_path):
            self.get_keys()

        self.io_loop = io_loop or tornado.ioloop.IOLoop.current()

        salt.utils.crypt.reinit_crypto()
        key = self.__key(self.opts)
        # TODO: if we already have creds for this key, lets just re-use
        if key in AsyncAuth.creds_map:
            creds = AsyncAuth.creds_map[key]
            self._creds = creds
            self._crypticle = Crypticle(self.opts, creds['aes'])
            self._authenticate_future = tornado.concurrent.Future()
            self._authenticate_future.set_result(True)
        else:
            self.authenticate()
def __singleton_init__ ( self , opts , io_loop = None ) : self . opts = opts if six . PY2 : self . token = Crypticle . generate_key_string ( ) else : self . token = salt . utils . stringutils . to_bytes ( Crypticle . generate_key_string ( ) ) self . serial = salt . payload . Serial ( self . opts ) self . pub_path = os . path . join ( self . opts [ 'pki_dir' ] , 'minion.pub' ) self . rsa_path = os . path . join ( self . opts [ 'pki_dir' ] , 'minion.pem' ) if self . opts [ '__role' ] == 'syndic' : self . mpub = 'syndic_master.pub' else : self . mpub = 'minion_master.pub' if not os . path . isfile ( self . pub_path ) : self . get_keys ( ) self . io_loop = io_loop or tornado . ioloop . IOLoop . current ( ) salt . utils . crypt . reinit_crypto ( ) key = self . __key ( self . opts ) if key in AsyncAuth . creds_map : creds = AsyncAuth . creds_map [ key ] self . _creds = creds self . _crypticle = Crypticle ( self . opts , creds [ 'aes' ] ) self . _authenticate_future = tornado . concurrent . Future ( ) self . _authenticate_future . set_result ( True ) else : self . authenticate ( )
Init an Auth instance

        :param dict opts: Options for this server
        :return: Auth instance
        :rtype: Auth