예제 #1
0
    def _create_client(self):
        ctx = context.ctx()

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

        # Check for trust scope token. This may occur if the action is
        # called from a workflow triggered by a Mistral cron trigger.
        if ctx.is_trust_scoped:
            auth_url = None
            mistral_endpoint = keystone_utils.get_endpoint_for_project(
                'mistral'
            )
            mistral_url = mistral_endpoint.url
        else:
            keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
            auth_url = keystone_endpoint.url
            mistral_url = None

        return self._get_client_class()(
            mistral_url=mistral_url,
            auth_token=ctx.auth_token,
            project_id=ctx.project_id,
            user_id=ctx.user_id,
            auth_url=auth_url
        )
예제 #2
0
    def _create_client(self):
        ctx = context.ctx()

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        nova_endpoint = keystone_utils.get_endpoint_for_project('nova')

        client = novaclient.Client(
            2,
            username=None,
            api_key=None,
            endpoint_type=CONF.os_actions_endpoint_type,
            service_type='compute',
            auth_token=ctx.auth_token,
            tenant_id=ctx.project_id,
            region_name=keystone_endpoint.region,
            auth_url=keystone_endpoint.url
        )

        client.client.management_url = keystone_utils.format_url(
            nova_endpoint.url,
            {'tenant_id': ctx.project_id}
        )

        return client
예제 #3
0
    def _get_client(self):
        ctx = context.ctx()

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

        # Check for trust scope token. This may occur if the action is
        # called from a workflow triggered by a Mistral cron trigger.
        if ctx.is_trust_scoped:
            auth_url = None
            mistral_endpoint = keystone_utils.get_endpoint_for_project(
                'mistral'
            )
            mistral_url = mistral_endpoint.url
        else:
            keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
            auth_url = keystone_endpoint.url
            mistral_url = None

        return self._client_class(
            mistral_url=mistral_url,
            auth_token=ctx.auth_token,
            project_id=ctx.project_id,
            user_id=ctx.user_id,
            auth_url=auth_url
        )
예제 #4
0
파일: actions.py 프로젝트: kantorv/mistral
    def _get_client(self):
        ctx = context.ctx()

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        nova_endpoint = keystone_utils.get_endpoint_for_project('nova')

        client = self._client_class(
            username=None,
            api_key=None,
            endpoint_type='publicURL',
            service_type='compute',
            auth_token=ctx.auth_token,
            tenant_id=ctx.project_id,
            region_name=keystone_endpoint.region,
            auth_url=keystone_endpoint.url
        )

        client.client.management_url = keystone_utils.format_url(
            nova_endpoint.url,
            {'tenant_id': ctx.project_id}
        )

        return client
예제 #5
0
    def _create_client(self):
        ctx = context.ctx()

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        tacker_endpoint = keystone_utils.get_endpoint_for_project('tacker')

        return self._get_client_class()(endpoint_url=tacker_endpoint.url,
                                        token=ctx.auth_token,
                                        tenant_id=ctx.project_id,
                                        region_name=tacker_endpoint.region,
                                        auth_url=keystone_endpoint.url)
예제 #6
0
    def _create_client(self, context):

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        tacker_endpoint = self.get_service_endpoint()

        return self._get_client_class()(endpoint_url=tacker_endpoint.url,
                                        token=context.auth_token,
                                        tenant_id=context.project_id,
                                        region_name=tacker_endpoint.region,
                                        auth_url=keystone_endpoint.url,
                                        insecure=context.insecure)
예제 #7
0
    def _get_client(self):
        ctx = context.ctx()

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        murano_endpoint = keystone_utils.get_endpoint_for_project('murano')

        return self._get_client_class()(endpoint=murano_endpoint.url,
                                        token=ctx.auth_token,
                                        tenant=ctx.project_id,
                                        region_name=murano_endpoint.region,
                                        auth_url=keystone_endpoint.url)
예제 #8
0
    def _create_client(self):
        ctx = context.ctx()

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        auth_url = keystone_endpoint.url
        magnum_url = keystone_utils.get_endpoint_for_project('magnum').url

        return self._get_client_class()(magnum_url=magnum_url,
                                        auth_token=ctx.auth_token,
                                        project_id=ctx.project_id,
                                        user_id=ctx.user_id,
                                        auth_url=auth_url)
예제 #9
0
    def _create_client(self, context):

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        zun_endpoint = self.get_service_endpoint()
        session_and_auth = self.get_session_and_auth(context)

        client = self._get_client_class()('1',
                                          endpoint_override=zun_endpoint.url,
                                          auth_url=keystone_endpoint.url,
                                          session=session_and_auth['session'])

        return client
예제 #10
0
    def _get_client(self):
        ctx = context.ctx()

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        tacker_endpoint = keystone_utils.get_endpoint_for_project('tacker')

        return self._get_client_class()(
            endpoint_url=tacker_endpoint.url,
            token=ctx.auth_token,
            tenant_id=ctx.project_id,
            region_name=tacker_endpoint.region,
            auth_url=keystone_endpoint.url
        )
예제 #11
0
    def _get_client(self):
        ctx = context.ctx()

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        murano_endpoint = keystone_utils.get_endpoint_for_project('murano')

        return self._client_class(
            endpoint=murano_endpoint.url,
            token=ctx.auth_token,
            tenant=ctx.project_id,
            region_name=murano_endpoint.region,
            auth_url=keystone_endpoint.url
        )
예제 #12
0
    def _get_client(self):
        ctx = context.ctx()

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        auth_url = keystone_endpoint.url
        magnum_url = keystone_utils.get_endpoint_for_project('magnum').url

        return self._get_client_class()(
            magnum_url=magnum_url,
            auth_token=ctx.auth_token,
            project_id=ctx.project_id,
            user_id=ctx.user_id,
            auth_url=auth_url
        )
예제 #13
0
    def _create_client(self):
        ctx = context.ctx()

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

        barbican_endpoint = keystone_utils.get_endpoint_for_project('barbican')
        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()

        auth = identity.v2.Token(auth_url=keystone_endpoint.url,
                                 tenant_name=ctx.user_name,
                                 token=ctx.auth_token,
                                 tenant_id=ctx.project_id)

        return self._get_client_class()(project_id=ctx.project_id,
                                        endpoint=barbican_endpoint.url,
                                        auth=auth)
예제 #14
0
    def _create_client(self):
        ctx = context.ctx()

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        senlin_endpoint = keystone_utils.get_endpoint_for_project('senlin')

        return self._get_client_class()(endpoint_url=senlin_endpoint.url,
                                        token=ctx.auth_token,
                                        tenant_id=ctx.project_id,
                                        region_name=senlin_endpoint.region,
                                        auth_url=keystone_endpoint.url)

        @classmethod
        def _get_fake_client(cls):
            return cls._get_client_class()("http://127.0.0.1:8778")
예제 #15
0
    def _create_client(self, context):

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

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

        return self._get_client_class()(endpoint_url=senlin_endpoint.url,
                                        token=context.auth_token,
                                        tenant_id=context.project_id,
                                        region_name=senlin_endpoint.region,
                                        auth_url=keystone_endpoint.url,
                                        insecure=context.insecure)

        @classmethod
        def _get_fake_client(cls):
            return cls._get_client_class()("http://127.0.0.1:8778")
예제 #16
0
    def _get_client(self):
        ctx = context.ctx()

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

        zaqar_endpoint = keystone_utils.get_endpoint_for_project(
            service_type='messaging')
        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()

        opts = {
            'os_auth_token': ctx.auth_token,
            'os_auth_url': keystone_endpoint.url,
            'os_project_id': ctx.project_id,
        }
        auth_opts = {'backend': 'keystone', 'options': opts}
        conf = {'auth_opts': auth_opts}

        return self._client_class(zaqar_endpoint.url, conf=conf)
예제 #17
0
    def _create_client(self):
        ctx = context.ctx()

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

        zaqar_endpoint = keystone_utils.get_endpoint_for_project(
            service_type='messaging')
        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()

        opts = {
            'os_auth_token': ctx.auth_token,
            'os_auth_url': keystone_endpoint.url,
            'os_project_id': ctx.project_id,
        }
        auth_opts = {'backend': 'keystone', 'options': opts}
        conf = {'auth_opts': auth_opts}

        return self._get_client_class()(zaqar_endpoint.url, conf=conf)
예제 #18
0
    def _get_client(self):
        ctx = context.ctx()

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

        barbican_endpoint = keystone_utils.get_endpoint_for_project('barbican')
        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()

        auth = identity.v2.Token(
            auth_url=keystone_endpoint.url,
            tenant_name=ctx.user_name,
            token=ctx.auth_token,
            tenant_id=ctx.project_id
        )

        return self._client_class(
            project_id=ctx.project_id,
            endpoint=barbican_endpoint.url,
            auth=auth
        )
예제 #19
0
    def _create_client(self, context):

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

        keystone_endpoint = keystone_utils.get_keystone_endpoint_v2()
        nova_endpoint = self.get_service_endpoint()

        client = novaclient.Client(
            2,
            username=None,
            api_key=None,
            endpoint_type=CONF.openstack_actions.os_actions_endpoint_type,
            service_type='compute',
            auth_token=context.auth_token,
            tenant_id=context.project_id,
            region_name=nova_endpoint.region,
            auth_url=keystone_endpoint.url,
            insecure=context.insecure)

        client.client.management_url = keystone_utils.format_url(
            nova_endpoint.url, {'tenant_id': context.project_id})

        return client