Пример #1
0
    def test_create_client(self, get_service_endpoint, do_init):
        ctx = context.get_admin_context()
        ctx.project_id = '123'

        cfg.CONF.set_default('version', '1', 'karbor_client')

        karbor_url = "http://127.0.0.1:9090"
        sc = karbor_client.create(ctx, endpoint=karbor_url)
        self.assertEqual(karbor_url, sc.http_client.endpoint)

        karbor_url = "http://127.0.0.1:9090/$(tenant_id)s"
        get_service_endpoint.return_value = karbor_url
        endpoint = karbor_url.replace("$(tenant_id)s", ctx.project_id)
        sc = karbor_client.create(ctx)
        self.assertEqual(endpoint, sc.http_client.endpoint)
Пример #2
0
    def test_create_client(self, get_service_endpoint):
        ctx = context.get_admin_context()
        ctx.project_id = '123'

        cfg.CONF.set_default('version', '1', 'karbor_client')

        karbor_url = "http://127.0.0.1:9090"
        sc = karbor_client.create(ctx, endpoint=karbor_url)
        self.assertEqual(karbor_url, sc.http_client.endpoint)

        karbor_url = "http://127.0.0.1:9090/$(project_id)s"
        get_service_endpoint.return_value = karbor_url
        endpoint = karbor_url.replace("$(project_id)s", ctx.project_id)
        sc = karbor_client.create(ctx)
        self.assertEqual(endpoint, sc.http_client.endpoint)
Пример #3
0
    def _create_karbor_client(cls, user_id, project_id):
        token = user_trust_manager.UserTrustManager().get_token(user_id, project_id)
        if not token:
            return None
        ctx = context.get_admin_context()
        ctx.auth_token = token
        ctx.project_id = project_id

        karbor_url = cls.KARBOR_ENDPOINT.replace("$(tenant_id)s", project_id)
        return karbor_client.create(ctx, endpoint=karbor_url)
Пример #4
0
    def _create_karbor_client(self, user_id, project_id):
        token = self._user_trust_manager.get_token(user_id, project_id)
        if not token:
            return None
        ctx = context.get_admin_context()
        ctx.auth_token = token
        ctx.project_id = project_id

        karbor_url = self.karbor_endpoint % {"project_id": project_id}
        return karbor_client.create(ctx, endpoint=karbor_url)
Пример #5
0
    def _create_karbor_client(cls, user_id, project_id):
        token = user_trust_manager.UserTrustManager().get_token(
            user_id, project_id)
        if not token:
            return None
        ctx = context.get_admin_context()
        ctx.auth_token = token
        ctx.project_id = project_id

        karbor_url = cls.KARBOR_ENDPOINT.replace("$(tenant_id)s", project_id)
        return karbor_client.create(ctx, endpoint=karbor_url)