summaryrefslogtreecommitdiffstats
path: root/keystone/catalog
diff options
context:
space:
mode:
authorTushar Patil <tushar.vitthal.patil@gmail.com>2013-01-10 00:46:23 -0800
committerTushar Patil <tushar.vitthal.patil@gmail.com>2013-01-11 16:31:10 -0800
commit3a38ecfc8868c95ad3df43de22b29f08f2c9d4cf (patch)
tree1920564c51be16929b9d44a91c64a7c95393a150 /keystone/catalog
parentcf3a3379c86415e8b2ecbefaa06da62570d768f0 (diff)
downloadkeystone-3a38ecfc8868c95ad3df43de22b29f08f2c9d4cf.tar.gz
keystone-3a38ecfc8868c95ad3df43de22b29f08f2c9d4cf.tar.xz
keystone-3a38ecfc8868c95ad3df43de22b29f08f2c9d4cf.zip
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
Diffstat (limited to 'keystone/catalog')
-rw-r--r--keystone/catalog/controllers.py6
1 files changed, 5 insertions, 1 deletions
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()