1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
18 """Return the endpoint from config or the catalog.
19
20 THIS IS FROM os_client_config.CloudConfig.get_session_endpoint()
21 If a configuration lists an explicit endpoint for a service,
22 return that. Otherwise, fetch the service catalog from the
23 keystone session and return the appropriate endpoint.
24
25 :param service_key: Generic key for service, such as 'compute' or
26 'network'
27
28 :returns: Endpoint for the service, or None if not found
29 """
30
31 override_endpoint = self.get_endpoint(service_key)
32 if override_endpoint:
33 return override_endpoint
34
35 session = self.get_session()
36 args = {
37 'service_type': self.get_service_type(service_key),
38 'service_name': self.get_service_name(service_key),
39 'interface': self.get_interface(service_key),
40 'region_name': self.region
41 }
42 try:
43 endpoint = session.get_endpoint(**args)
44 except keystoneauth1.exceptions.catalog.EndpointNotFound:
45 self.log.warning("Keystone catalog entry not found (%s)",
46 args)
47 endpoint = None
48 return endpoint
49