Use V3 auth_url

When executing 'murano environment create test' command, the result
is failed because keystone has delete V2 api. Therefore murano need
to use V3 auth_url.

Change-Id: Ia9874949c0e7bdef733815ae6d37a3f19784abe3
Co-Authored-By: zhurong <aaronzhu1121@gmail.com>
This commit is contained in:
chenaidong1 2017-10-22 09:11:10 +08:00 committed by zhurong
parent 044a190e81
commit a4931ab8d9
1 changed files with 10 additions and 1 deletions

View File

@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from keystoneauth1 import identity
from keystoneauth1 import loading as ka_loading
from keystoneclient.v3 import client as ks_client
@ -73,7 +75,14 @@ def get_token_client_session(token=None, project_id=None, conf=None):
CFG_MURANO_AUTH_GROUP + 'group')
www_authenticate_uri = \
cfg.CONF[CFG_KEYSTONE_GROUP].www_authenticate_uri
auth_url = www_authenticate_uri.replace('v2.0', 'v3')
if not (www_authenticate_uri.endswith('v2.0') or
www_authenticate_uri.endswith('v3')):
auth_url = os.path.join(www_authenticate_uri, 'v3')
elif www_authenticate_uri.endswith('v2.0'):
auth_url = www_authenticate_uri.replace('v2.0', 'v3')
else:
auth_url = www_authenticate_uri
if token is None or project_id is None:
execution_session = helpers.get_execution_session()
token = execution_session.token