예제 #1
0
    def _set_identity_clients(self):
        params = {
            'service': CONF.identity.catalog_type,
            'region': CONF.identity.region,
            'endpoint_type': 'adminURL'
        }
        params.update(self.default_params_with_timeout_values)

        self.identity_client = IdentityClient(self.auth_provider, **params)
        self.identity_v3_client = IdentityV3Client(self.auth_provider,
                                                   **params)
        self.endpoints_client = EndPointClient(self.auth_provider, **params)
        self.service_client = ServiceClient(self.auth_provider, **params)
        self.policy_client = PolicyClient(self.auth_provider, **params)
        self.region_client = RegionClient(self.auth_provider, **params)
        self.credentials_client = CredentialsClient(self.auth_provider,
                                                    **params)
        # Token clients do not use the catalog. They only need default_params.
        # They read auth_url, so they should only be set if the corresponding
        # API version is marked as enabled
        if CONF.identity_feature_enabled.api_v2:
            if CONF.identity.uri:
                self.token_client = TokenClientJSON(CONF.identity.uri,
                                                    **self.default_params)
            else:
                msg = 'Identity v2 API enabled, but no identity.uri set'
                raise exceptions.InvalidConfiguration(msg)
        if CONF.identity_feature_enabled.api_v3:
            if CONF.identity.uri_v3:
                self.token_v3_client = V3TokenClientJSON(
                    CONF.identity.uri_v3, **self.default_params)
            else:
                msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
                raise exceptions.InvalidConfiguration(msg)
예제 #2
0
 def _set_identity_clients(self):
     params = {
         'service': CONF.identity.catalog_type,
         'region': CONF.identity.region
     }
     params.update(self.default_params_with_timeout_values)
     params_v2_admin = params.copy()
     params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type
     # Client uses admin endpoint type of Keystone API v2
     self.identity_client = IdentityClient(self.auth_provider,
                                           **params_v2_admin)
     params_v2_public = params.copy()
     params_v2_public['endpoint_type'] = (
         CONF.identity.v2_public_endpoint_type)
     # Client uses public endpoint type of Keystone API v2
     self.identity_public_client = IdentityClient(self.auth_provider,
                                                  **params_v2_public)
     params_v3 = params.copy()
     params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
     # Client uses the endpoint type of Keystone API v3
     self.identity_v3_client = IdentityV3Client(self.auth_provider,
                                                **params_v3)
     self.endpoints_client = EndPointClient(self.auth_provider, **params)
     self.service_client = ServiceClient(self.auth_provider, **params)
     self.policy_client = PolicyClient(self.auth_provider, **params)
     self.region_client = RegionClient(self.auth_provider, **params)
     self.credentials_client = CredentialsClient(self.auth_provider,
                                                 **params)
     self.groups_client = GroupsClient(self.auth_provider, **params_v3)
     # Token clients do not use the catalog. They only need default_params.
     # They read auth_url, so they should only be set if the corresponding
     # API version is marked as enabled
     if CONF.identity_feature_enabled.api_v2:
         if CONF.identity.uri:
             self.token_client = TokenClient(CONF.identity.uri,
                                             **self.default_params)
         else:
             msg = 'Identity v2 API enabled, but no identity.uri set'
             raise exceptions.InvalidConfiguration(msg)
     if CONF.identity_feature_enabled.api_v3:
         if CONF.identity.uri_v3:
             self.token_v3_client = V3TokenClient(CONF.identity.uri_v3,
                                                  **self.default_params)
         else:
             msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
             raise exceptions.InvalidConfiguration(msg)