Esempio n. 1
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)
     self.tenants_client = TenantsClient(self.auth_provider,
                                         **params_v2_admin)
     self.roles_client = RolesClient(self.auth_provider, **params_v2_admin)
     self.users_client = UsersClient(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)
     self.tenants_public_client = TenantsClient(self.auth_provider,
                                                **params_v2_public)
     self.roles_public_client = RolesClient(self.auth_provider,
                                            **params_v2_public)
     self.users_public_client = UsersClient(self.auth_provider,
                                            **params_v2_public)
     params_v3 = params.copy()
     params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
     # Clients below use the endpoint type of Keystone API v3
     self.identity_v3_client = IdentityV3Client(self.auth_provider,
                                                **params_v3)
     self.endpoints_client = EndPointV3Client(self.auth_provider,
                                              **params_v3)
     self.identity_services_client = IdentityServicesV3Client(
         self.auth_provider, **params_v3)
     self.policies_client = PoliciesV3Client(self.auth_provider,
                                             **params_v3)
     self.regions_client = RegionsV3Client(self.auth_provider, **params_v3)
     self.credentials_client = CredentialsV3Client(self.auth_provider,
                                                   **params_v3)
     self.groups_client = GroupsV3Client(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)
    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 = IdentityClientJSON(self.auth_provider, **params)
        self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider,
                                                       **params)
        self.endpoints_client = EndPointClientJSON(self.auth_provider,
                                                   **params)
        self.service_client = ServiceClientJSON(self.auth_provider, **params)
        self.policy_client = PolicyClientJSON(self.auth_provider, **params)
        self.region_client = RegionClientJSON(self.auth_provider, **params)
        self.credentials_client = CredentialsClientJSON(
            self.auth_provider, **params)
        # Token clients do not use the catalog. They only need default_params.
        self.token_client = TokenClient(CONF.identity.uri,
                                        **self.default_params)
        if CONF.identity_feature_enabled.api_v3:
            self.token_v3_client = V3TokenClient(CONF.identity.uri_v3,
                                                 **self.default_params)