From 40c17e30fc1b457ac4975a2faa3e3b341defdf32 Mon Sep 17 00:00:00 2001 From: Sam Betts Date: Mon, 1 Feb 2016 15:37:36 +0000 Subject: [PATCH] Enable Keystone v3 endpoints for Inspector Change-Id: Iaa6d1b9dcca401987ac5f8ccc37e337736905b92 Closes-Bug: #1531236 --- devstack/plugin.sh | 2 +- ironic_inspector/test/test_utils.py | 6 +++--- ironic_inspector/utils.py | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index f4991a3d5..d40d9a064 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -154,7 +154,7 @@ function configure_inspector { cp "$IRONIC_INSPECTOR_DIR/example.conf" "$IRONIC_INSPECTOR_CONF_FILE" inspector_iniset DEFAULT debug $IRONIC_INSPECTOR_DEBUG - inspector_iniset ironic os_auth_url "$KEYSTONE_SERVICE_URI/v2.0" + inspector_iniset ironic os_auth_url "$KEYSTONE_SERVICE_URI" inspector_iniset ironic os_username $IRONIC_INSPECTOR_ADMIN_USER inspector_iniset ironic os_password $SERVICE_PASSWORD inspector_iniset ironic os_tenant_name $SERVICE_TENANT_NAME diff --git a/ironic_inspector/test/test_utils.py b/ironic_inspector/test/test_utils.py index 37d85d290..83e69b892 100644 --- a/ironic_inspector/test/test_utils.py +++ b/ironic_inspector/test/test_utils.py @@ -15,7 +15,7 @@ import socket import unittest from ironicclient import client -import keystoneclient.v2_0.client as keystone_client +from keystoneclient import client as keystone_client from keystonemiddleware import auth_token from oslo_config import cfg @@ -70,7 +70,7 @@ class TestCheckAuth(base.BaseTest): CONF.set_override('admin_user', 'admin', 'keystone_authtoken') CONF.set_override('admin_tenant_name', 'admin', 'keystone_authtoken') CONF.set_override('admin_password', 'password', 'keystone_authtoken') - CONF.set_override('auth_uri', 'http://127.0.0.1:5000/v2.0', + CONF.set_override('auth_uri', 'http://127.0.0.1:5000', 'keystone_authtoken') CONF.set_override('identity_uri', 'http://127.0.0.1:35357', 'keystone_authtoken') @@ -87,7 +87,7 @@ class TestCheckAuth(base.BaseTest): self.assertEqual('admin', args1['admin_tenant_name']) self.assertEqual('password', args1['admin_password']) self.assertTrue(args1['delay_auth_decision']) - self.assertEqual('http://127.0.0.1:5000/v2.0', args1['auth_uri']) + self.assertEqual('http://127.0.0.1:5000', args1['auth_uri']) self.assertEqual('http://127.0.0.1:35357', args1['identity_uri']) @mock.patch.object(auth_token, 'AuthProtocol') diff --git a/ironic_inspector/utils.py b/ironic_inspector/utils.py index f2b9ed5b5..6e6b264c9 100644 --- a/ironic_inspector/utils.py +++ b/ironic_inspector/utils.py @@ -16,7 +16,7 @@ import socket import eventlet from ironicclient import client -import keystoneclient.v2_0.client as keystone_client +from keystoneclient import client as keystone_client from keystonemiddleware import auth_token from oslo_config import cfg from oslo_log import log @@ -82,6 +82,9 @@ def get_client(token=None, 'auth_url': CONF.ironic.os_auth_url, 'tenant_name': CONF.ironic.os_tenant_name} keystone = keystone_client.Client(**keystone_creds) + # FIXME(sambetts): Work around for Bug 1539839 as client.authenticate + # is not called. + keystone.authenticate() ironic_url = keystone.service_catalog.url_for( service_type=CONF.ironic.os_service_type, endpoint_type=CONF.ironic.os_endpoint_type)