Package list python-castellan / bfcf4b2
Simplify the reference to barbican parameters ... so that we can easily identify the logics which are referring to configuration parameters. Change-Id: I93427a64b83f474c7c2dd45c8c200e7a3c9bc6f9 Takashi Kajinami 1 year, 4 months ago
1 changed file(s) with 13 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
190190 raise exception.Forbidden(reason=msg)
191191
192192 def _get_barbican_endpoint(self, auth, sess):
193 barbican = self.conf.barbican
194 if barbican.barbican_endpoint:
195 return barbican.barbican_endpoint
193 if self.conf.barbican.barbican_endpoint:
194 return self.conf.barbican.barbican_endpoint
196195 elif getattr(auth, 'service_catalog', None):
197196 endpoint_data = auth.service_catalog.endpoint_data_for(
198197 service_type='key-manager',
199 interface=barbican.barbican_endpoint_type,
200 region_name=barbican.barbican_region_name)
198 interface=self.conf.barbican.barbican_endpoint_type,
199 region_name=self.conf.barbican.barbican_region_name)
201200 return endpoint_data.url
202201 else:
203 service_parameters = {'service_type': 'key-manager',
204 'interface': barbican.barbican_endpoint_type,
205 'region_name': barbican.barbican_region_name}
206 return auth.get_endpoint(sess, **service_parameters)
202 return auth.get_endpoint(
203 sess,
204 service_type='key-manager',
205 interface=self.conf.barbican.barbican_endpoint_type,
206 region_name=self.conf.barbican.barbican_region_name)
207207
208208 def _create_base_url(self, auth, sess, endpoint):
209 barbican = self.conf.barbican
210209 api_version = None
211 if barbican.barbican_api_version:
212 api_version = barbican.barbican_api_version
210 if self.conf.barbican.barbican_api_version:
211 api_version = self.conf.barbican.barbican_api_version
213212 elif getattr(auth, 'service_catalog', None):
214213 endpoint_data = auth.service_catalog.endpoint_data_for(
215214 service_type='key-manager',
216 interface=barbican.barbican_endpoint_type,
217 region_name=barbican.barbican_region_name)
215 interface=self.conf.barbican.barbican_endpoint_type,
216 region_name=self.conf.barbican.barbican_region_name)
218217 api_version = endpoint_data.api_version
219218 elif getattr(auth, 'get_discovery', None):
220219 discovery = auth.get_discovery(sess, url=endpoint)