Stop trying to use identity URI if dashboard URL exists
At the moment, if dashboard_url is overridden, we still try to make a request to introspect based-off the identity URI which isn't correct behaviour. This patch short-circuits this entire behaviour if there's a dashboard_url provided. Change-Id: Ifeaec3337e5155ad1f5adeca85fce00b611a631d
This commit is contained in:
parent
33b2a939b5
commit
d4c30061e5
@ -22,11 +22,14 @@ from config_tempest import constants as C
|
||||
|
||||
|
||||
def configure_horizon(conf, **kwargs):
|
||||
"""Derive the horizon URIs from the identity's URI."""
|
||||
uri = conf.get('identity', 'uri')
|
||||
u = urllib.parse.urlparse(uri)
|
||||
base = '%s://%s%s' % (u.scheme, u.netloc.replace(
|
||||
':' + str(u.port), ''), '/dashboard')
|
||||
"""Verify horizon is working (fallback to introspect from identity URI)"""
|
||||
if conf.has_option("dashboard", "dashboard_url"):
|
||||
base = conf.get("dashboard", "dashboard_url")
|
||||
else:
|
||||
uri = conf.get('identity', 'uri')
|
||||
u = urllib.parse.urlparse(uri)
|
||||
base = '%s://%s%s' % (u.scheme, u.netloc.replace(
|
||||
':' + str(u.port), ''), '/dashboard')
|
||||
assert base.startswith('http:') or base.startswith('https:')
|
||||
has_horizon = True
|
||||
try:
|
||||
|
@ -28,6 +28,18 @@ class TestConfigTempest(BaseConfigTempestTest):
|
||||
super(TestConfigTempest, self).setUp()
|
||||
self.conf = self._get_conf("v2.0", "v3")
|
||||
|
||||
def test_configure_horizon_overridden(self):
|
||||
mock_function = mock.Mock(return_value=True)
|
||||
self.useFixture(MonkeyPatch('six.moves.urllib.request.urlopen',
|
||||
mock_function))
|
||||
self.conf.set("dashboard", "dashboard_url", "http://172.16.52.151")
|
||||
horizon.configure_horizon(self.conf)
|
||||
self.assertEqual(self.conf.get('service_available', 'horizon'), "True")
|
||||
self.assertEqual(self.conf.get('dashboard', 'dashboard_url'),
|
||||
"http://172.16.52.151/")
|
||||
self.assertEqual(self.conf.get('dashboard', 'login_url'),
|
||||
"http://172.16.52.151/auth/login/")
|
||||
|
||||
def test_configure_horizon_ipv4(self):
|
||||
mock_function = mock.Mock(return_value=True)
|
||||
self.useFixture(MonkeyPatch('six.moves.urllib.request.urlopen',
|
||||
|
Loading…
x
Reference in New Issue
Block a user