Package yakumo :: Module patch
[hide private]
[frames] | no frames]

Source Code for Module yakumo.patch

 1  # Copyright (c) 2014 Hewlett-Packard Development Company, L.P. 
 2  # Copyright (c) 2017 Akira Yoshiyama 
 3  # 
 4  # Licensed under the Apache License, Version 2.0 (the "License"); you may 
 5  # not use this file except in compliance with the License. You may obtain 
 6  # a copy of the License at 
 7  # 
 8  #      http://www.apache.org/licenses/LICENSE-2.0 
 9  # 
10  # Unless required by applicable law or agreed to in writing, software 
11  # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
12  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
13  # License for the specific language governing permissions and limitations 
14  # under the License. 
15   
16   
17 -def get_session_endpoint(self, service_key):
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 # don't make keystone special 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