From 3a38ecfc8868c95ad3df43de22b29f08f2c9d4cf Mon Sep 17 00:00:00 2001 From: Tushar Patil Date: Thu, 10 Jan 2013 00:46:23 -0800 Subject: Validated URLs in v2 endpoint creation API Fixed the 500 response when endpoint is created without specifying either adminurl, publicurl or internalurl empty. Added unit test coverage for v2 endpoint create API. Fixes LP: #1097747 Change-Id: I1875859bd7e197e985a5b5395c8caefff3c83b11 --- keystone/catalog/controllers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'keystone/catalog') diff --git a/keystone/catalog/controllers.py b/keystone/catalog/controllers.py index 78afffe7..8dddf469 100644 --- a/keystone/catalog/controllers.py +++ b/keystone/catalog/controllers.py @@ -81,9 +81,13 @@ class Endpoint(controller.V2Controller): """Create three v3 endpoint refs based on a legacy ref.""" self.assert_admin(context) + # according to the v2 spec publicurl is mandatory + self._require_attribute(endpoint, 'publicurl') + legacy_endpoint_ref = endpoint.copy() - urls = dict((i, endpoint.pop('%surl' % i)) for i in INTERFACES) + urls = dict((i, endpoint.pop('%surl' % i)) for i in INTERFACES + if endpoint.get('%surl' % i) is not None) legacy_endpoint_id = uuid.uuid4().hex for interface, url in urls.iteritems(): endpoint_ref = endpoint.copy() -- cgit