Exemplo n.º 1
0
    def _create_client(self):
        ctx = context.ctx()

        LOG.debug("Keystone action security context: %s" % ctx)

        # TODO(akovi) cacert is deprecated in favor of session
        # TODO(akovi) this piece of code should be refactored
        # TODO(akovi) to follow the new guide lines
        kwargs = {
            'token': ctx.auth_token,
            'auth_url': ctx.auth_uri,
            'project_id': ctx.project_id,
            'cacert': ctx.auth_cacert,
        }

        # In case of trust-scoped token explicitly pass endpoint parameter.
        if (ctx.is_trust_scoped
                or keystone_utils.is_token_trust_scoped(ctx.auth_token)):
            kwargs['endpoint'] = ctx.auth_uri

        client = self._get_client_class()(**kwargs)

        client.management_url = ctx.auth_uri

        return client
Exemplo n.º 2
0
    def _get_client(self):
        ctx = context.ctx()

        LOG.debug("Keystone action security context: %s" % ctx)

        # TODO(akovi) cacert is deprecated in favor of session
        # TODO(akovi) this piece of code should be refactored
        # TODO(akovi) to follow the new guide lines
        kwargs = {
            'token': ctx.auth_token,
            'auth_url': ctx.auth_uri,
            'project_id': ctx.project_id,
            'cacert': ctx.auth_cacert,
        }

        # In case of trust-scoped token explicitly pass endpoint parameter.
        if (ctx.is_trust_scoped
                or keystone_utils.is_token_trust_scoped(ctx.auth_token)):
            kwargs['endpoint'] = ctx.auth_uri

        client = self._get_client_class()(**kwargs)

        client.management_url = ctx.auth_uri

        return client
Exemplo n.º 3
0
    def _create_client(self, context):

        LOG.debug("Senlin action security context: %s", context)

        keystone_endpoint = keystone_utils.get_keystone_endpoint()
        senlin_endpoint = self.get_service_endpoint()

        if context.is_trust_scoped and keystone_utils.is_token_trust_scoped(
                context.auth_token):
            if context.trust_id is None:
                raise Exception(
                    "'trust_id' must be provided in the admin context.")

            auth = ks_identity_v3.Password(
                auth_url=keystone_endpoint.url,
                trust_id=context.trust_id,
                username=CONF.keystone_authtoken.username,
                password=CONF.keystone_authtoken.password,
                user_domain_name=CONF.keystone_authtoken.user_domain_name)
        else:
            auth = ks_identity_v3.Token(auth_url=keystone_endpoint.url,
                                        token=context.auth_token,
                                        project_id=context.project_id)

        return self._get_client_class()(endpoint_url=senlin_endpoint.url,
                                        session=ks_session.Session(auth=auth),
                                        tenant_id=context.project_id,
                                        region_name=senlin_endpoint.region,
                                        auth_url=keystone_endpoint.url,
                                        insecure=context.insecure)
Exemplo n.º 4
0
    def _get_client(self):
        ctx = context.ctx()

        LOG.debug("Keystone action security context: %s" % ctx)

        kwargs = {
            'token': ctx.auth_token,
            'auth_url': CONF.keystone_authtoken.auth_uri,
            'project_id': ctx.project_id,
            'cacert': CONF.keystone_authtoken.cafile,
        }

        # In case of trust-scoped token explicitly pass endpoint parameter.
        if (ctx.is_trust_scoped
                or keystone_utils.is_token_trust_scoped(ctx.auth_token)):
            kwargs['endpoint'] = CONF.keystone_authtoken.auth_uri

        client = self._client_class(**kwargs)

        client.management_url = CONF.keystone_authtoken.auth_uri

        return client
Exemplo n.º 5
0
    def _get_client(self):
        ctx = context.ctx()

        LOG.debug("Keystone action security context: %s" % ctx)

        kwargs = {
            'token': ctx.auth_token,
            'auth_url': CONF.keystone_authtoken.auth_uri,
            'project_id': ctx.project_id,
            'cacert': CONF.keystone_authtoken.cafile,
        }

        # In case of trust-scoped token explicitly pass endpoint parameter.
        if (ctx.is_trust_scoped
                or keystone_utils.is_token_trust_scoped(ctx.auth_token)):
            kwargs['endpoint'] = CONF.keystone_authtoken.auth_uri

        client = self._client_class(**kwargs)

        client.management_url = CONF.keystone_authtoken.auth_uri

        return client