From 95771cf112128f5f22a6a5e2e1e0e2d251f29e53 Mon Sep 17 00:00:00 2001 From: Nikhil Komawar Date: Mon, 6 Feb 2012 22:56:20 +0000 Subject: dont show blank endpoint headers fixes bug: 741972 Change-Id: I4a661a13c5baaa79ee647a6c1cedcef29a2642f6 --- nova/api/openstack/auth.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index 8e0a71d4f..84e0b16ca 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -52,8 +52,6 @@ class NoAuthMiddleware(base_wsgi.Middleware): # 2.0 auth here as well. res.headers['X-Auth-Token'] = '%s:%s' % (user_id, project_id) res.headers['X-Server-Management-Url'] = os_url - res.headers['X-Storage-Url'] = '' - res.headers['X-CDN-Management-Url'] = '' res.content_type = 'text/plain' res.status = '204' return res @@ -177,8 +175,14 @@ class AuthMiddleware(base_wsgi.Middleware): res.headers['X-Auth-Token'] = token['token_hash'] res.headers['X-Server-Management-Url'] = \ token['server_management_url'] - res.headers['X-Storage-Url'] = token['storage_url'] - res.headers['X-CDN-Management-Url'] = token['cdn_management_url'] + + if token['storage_url']: + res.headers['X-Storage-Url'] = token['storage_url'] + + if token['cdn_management_url']: + res.headers['X-CDN-Management-Url'] = \ + token['cdn_management_url'] + res.content_type = 'text/plain' res.status = '204' LOG.debug(_("Successfully authenticated '%s'") % username) -- cgit