Пример #1
0
    def _get_auth(self):
        if self.context.is_admin:
            auth = ka_loading.load_auth_from_conf_options(CONF, CFG_GROUP)
        elif self.context.auth_token_info:
            access_info = ka_access.create(body=self.context.auth_token_info,
                                           auth_token=self.context.auth_token)
            auth = ka_access_plugin.AccessInfoPlugin(access_info)
        elif self.context.auth_token:
            auth = ka_v3.Token(auth_url=self.auth_url,
                               token=self.context.auth_token)
        else:
            LOG.error(_LE('Keystone API connection failed: no password '
                          'or token found.'))
            raise exception.AuthorizationFailure()

        return auth
Пример #2
0
    def _get_auth(self):
        if self.context.is_admin:
            auth = ka_loading.load_auth_from_conf_options(CONF, CFG_GROUP)
        elif self.context.auth_token_info:
            access_info = ka_access.create(body=self.context.auth_token_info,
                                           auth_token=self.context.auth_token)
            auth = ka_access_plugin.AccessInfoPlugin(access_info)
        elif self.context.auth_token:
            auth = ka_v3.Token(auth_url=self.auth_url,
                               token=self.context.auth_token)
        else:
            msg = ('Keystone API connection failed: no password, '
                   'trust_id or token found.')
            LOG.error(msg)
            raise exception.AuthorizationFailure(client='keystone',
                                                 message='reason %s' % msg)

        return auth
Пример #3
0
 def _get_auth(self):
     #LOG.debug('KeystoneClient _get_auth xxx is_admin=%s,auth_token=%s,auth_token_info=%s', self.context.is_admin, self.context.auth_token,self.context.auth_token_info)
     if self.context.is_admin:
         auth = ka_loading.load_auth_from_conf_options(CONF, CFG_GROUP)
         #LOG.debug('KeystoneClient _get_auth xxx auth=%s', auth.__dict__);
     elif self.context.auth_token_info:
         #LOG.debug('KeystoneClient _get_auth xxx auth_token_info inside');
         access_info = ka_access.create(body=self.context.auth_token_info,
                                        auth_token=self.context.auth_token)
         auth = ka_access_plugin.AccessInfoPlugin(access_info)
     elif self.context.auth_token:
         #LOG.debug('KeystoneClient _get_auth xxx auth_token inside');
         auth = ka_v3.Token(auth_url=self.auth_url,
                            token=self.context.auth_token)
     else:
         msg = ('Keystone API connection failed: no password, '
                'trust_id or token found.')
         LOG.error(msg)
         raise exception.AuthorizationFailure(client='keystone',
                                              message='reason %s' % msg)
     #LOG.debug('KeystoneClient _get_auth xxx final auth=%s', auth);
     return auth