diff options
| author | Ziad Sawalha <github@highbridgellc.com> | 2011-12-26 10:32:38 -0600 |
|---|---|---|
| committer | Ziad Sawalha <github@highbridgellc.com> | 2011-12-27 10:45:15 -0600 |
| commit | ae3c3da36411238eb66eea7aee2c7e3530ab54f1 (patch) | |
| tree | 68d427f095bdf37a9dd9cdfa5dbfc5bd35b06625 | |
| parent | 067ab5b254d1375c44eaa640d8d4269c8fbfe3b4 (diff) | |
| download | keystone-ae3c3da36411238eb66eea7aee2c7e3530ab54f1.tar.gz keystone-ae3c3da36411238eb66eea7aee2c7e3530ab54f1.tar.xz keystone-ae3c3da36411238eb66eea7aee2c7e3530ab54f1.zip | |
Added global endpoints response in XML as well
Change-Id: I3287387e1847cc06fe4d90e90c13ff12ae436f2a
| -rwxr-xr-x | keystone/logic/types/auth.py | 23 | ||||
| -rwxr-xr-x | run_tests.py | 2 |
2 files changed, 18 insertions, 7 deletions
diff --git a/keystone/logic/types/auth.py b/keystone/logic/types/auth.py index f583abd5..cb150f63 100755 --- a/keystone/logic/types/auth.py +++ b/keystone/logic/types/auth.py @@ -337,7 +337,7 @@ class AuthData(object): name=unicode(self.user.username)) dom.append(user) - if self.user.role_refs != None: + if self.user.role_refs is not None: user.append(self.user.role_refs.to_dom()) if self.base_urls is not None or len(self.base_urls) > 0: @@ -350,17 +350,28 @@ class AuthData(object): service = etree.Element("service", name=dservice.name, type=dservice.type) for base_url in key_base_urls: + include_this_endpoint = False endpoint = etree.Element("endpoint") if base_url.region: endpoint.set("region", base_url.region) for url_kind in self.url_types: base_url_item = getattr(base_url, url_kind + "_url") if base_url_item: - endpoint.set(url_kind + "URL", base_url_item.\ - replace('%tenant_id%', str(self.token.tenant.id)) - if self.token.tenant else base_url_item) - service.append(endpoint) - service_catalog.append(service) + if '%tenant_id%' in base_url_item: + if self.token.tenant: + # Don't return tenant endpoints if token + # not scoped to a tenant + endpoint.set(url_kind + "URL", + base_url_item.replace('%tenant_id%', + str(self.token.tenant.id))) + include_this_endpoint = True + else: + endpoint.set(url_kind + "URL", base_url_item) + include_this_endpoint = True + if include_this_endpoint: + service.append(endpoint) + if service.find("endpoint") is not None: + service_catalog.append(service) dom.append(service_catalog) return etree.tostring(dom) diff --git a/run_tests.py b/run_tests.py index c4cf012f..89a08f71 100755 --- a/run_tests.py +++ b/run_tests.py @@ -64,6 +64,6 @@ if __name__ == '__main__': else: for test_num, test_cls in enumerate(TESTS): - print 'Runing test suite: %s' % test_cls.__name__ + print 'Running test suite: %s' % test_cls.__name__ if test_cls().run(): exit(1) |
