From 718cb9c9b475a705783c0cd07a0c02b9be33f0c6 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Mon, 29 Oct 2018 23:47:17 -0700 Subject: [PATCH] Add support for www_authentication_uri We do currently not support www_authentication_uri at all, which is the new standard, as auth_uri has long been deprecated. * Make sure we support both auth_uri and www_authenticate_uri. * Switched to www_authenticate_uri for devstack. * Fixed a bug where a bad exception would be thrown if auth_uri was not set. Story: 2004271 Task: 27819 Change-Id: Ibc932d35f3d6ba2ac7ffb6193aa37bd4a3d4422e --- devstack/lib/magnum | 2 +- magnum/common/keystone.py | 7 ++++++- magnum/tests/contrib/post_test_hook.sh | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/devstack/lib/magnum b/devstack/lib/magnum index 79bc90d30c..8e1abd9fe0 100644 --- a/devstack/lib/magnum +++ b/devstack/lib/magnum @@ -160,7 +160,7 @@ function create_magnum_conf { configure_auth_token_middleware $MAGNUM_CONF magnum $MAGNUM_AUTH_CACHE_DIR iniset $MAGNUM_CONF keystone_auth auth_url $KEYSTONE_AUTH_URI_V3 - iniset $MAGNUM_CONF keystone_authtoken auth_uri $KEYSTONE_SERVICE_URI_V3 + iniset $MAGNUM_CONF keystone_authtoken www_authenticate_uri $KEYSTONE_SERVICE_URI_V3 iniset $MAGNUM_CONF keystone_authtoken auth_url $KEYSTONE_AUTH_URI_V3 iniset $MAGNUM_CONF keystone_authtoken auth_version v3 diff --git a/magnum/common/keystone.py b/magnum/common/keystone.py index 44bf38f827..59ac8be972 100755 --- a/magnum/common/keystone.py +++ b/magnum/common/keystone.py @@ -44,7 +44,12 @@ class KeystoneClientV3(object): def auth_url(self): # FIXME(pauloewerton): auth_url should be retrieved from keystone_auth # section by default - return CONF[ksconf.CFG_LEGACY_GROUP].auth_uri.replace('v2.0', 'v3') + conf = CONF[ksconf.CFG_LEGACY_GROUP] + auth_uri = (getattr(conf, 'www_authenticate_uri', None) or + getattr(conf, 'auth_uri', None)) + if auth_uri: + auth_uri = auth_uri.replace('v2.0', 'v3') + return auth_uri @property def auth_token(self): diff --git a/magnum/tests/contrib/post_test_hook.sh b/magnum/tests/contrib/post_test_hook.sh index 92b88880f2..dd53fe327c 100755 --- a/magnum/tests/contrib/post_test_hook.sh +++ b/magnum/tests/contrib/post_test_hook.sh @@ -68,7 +68,7 @@ function create_test_data { local magnum_api_ip=$(iniget /etc/magnum/magnum.conf api host) local magnum_api_port=$(iniget /etc/magnum/magnum.conf api port) local magnum_url="http://"$magnum_api_ip":"$magnum_api_port"/v1" - local keystone_auth_url=$(iniget /etc/magnum/magnum.conf keystone_authtoken auth_uri) + local keystone_auth_url=$(iniget /etc/magnum/magnum.conf keystone_authtoken www_authenticate_uri) # pass the appropriate variables via a config file CREDS_FILE=$MAGNUM_DIR/functional_creds.conf