Use the library method auth_uri_transform.

Use the library method auth_uri_transform to transform the auth uri
by the auth version.

Change-Id: Ifd3a45dbe76f20e5ab142894e4c0267e0cbda936
Implements: blueprint move-keystone-authtoken-move-auth-uri-logic
This commit is contained in:
ericzhou 2014-03-15 23:42:16 +08:00
parent 6ef026325c
commit d316106989
7 changed files with 27 additions and 5 deletions

View File

@ -2,6 +2,10 @@ openstack-block-storage Cookbook CHANGELOG
==============================
This file is used to list changes made in each version of the openstack-block-storage cookbook.
## 8.4.0
### Blue print
* Use the library method auth_uri_transform
## 8.3.0
* Rename openstack-metering to openstack-telemetry

View File

@ -50,7 +50,8 @@ Attributes
TODO: Add DB2 support on other platforms
* `openstack["block-storage"]["platform"]["db2_python_packages"]` - Array of DB2 python packages, only available on redhat platform
* `openstack["block-storage"]["volume_name_template"]` - Template string to be used to generate volume names
* `openstack["block-storage"]["snapshot_name_template"]` - Template string to be used to generate snapshot names
* `openstack["block-storage"]["snapshot_name_template"]` - Template string to be used to generate snapshot names
* `openstack['block-storage']['api']['auth']['version']` - Select v2.0 or v3.0. Default v2.0 inherited from common cookbook. The default auth API version used to interact with identity service.
MQ attributes
-------------
@ -189,12 +190,13 @@ License and Author
| **Author** | Salman Baset (<sabaset@us.ibm.com>) |
| **Author** | Chen Zhiwei (<zhiwchen@cn.ibm.com>) |
| **Author** | Mark Vanderwiel (<vanderwl@us.ibm.com>) |
| **Author** | Eric Zhou (<zyouzhou@cn.ibm.com>) |
| | |
| **Copyright** | Copyright (c) 2012, Rackspace US, Inc. |
| **Copyright** | Copyright (c) 2012-2013, AT&T Services, Inc. |
| **Copyright** | Copyright (c) 2013, Opscode, Inc. |
| **Copyright** | Copyright (c) 2013, SUSE Linux GmbH |
| **Copyright** | Copyright (c) 2013, IBM, Corp. |
| **Copyright** | Copyright (c) 2013-2014, IBM, Corp. |
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -60,6 +60,8 @@ default['openstack']['block-storage']['keystone_service_chef_role'] = 'keystone'
# of the api-paste.ini when node['openstack']['auth']['strategy'] == 'pki'
default['openstack']['block-storage']['api']['auth']['cache_dir'] = '/var/cache/cinder/api'
default['openstack']['block-storage']['api']['auth']['version'] = node['openstack']['api']['auth']['version']
# Maximum allocatable gigabytes
# Should equal total backend storage, default is 10TB
default['openstack']['block-storage']['max_gigabytes'] = '10000'

View File

@ -5,7 +5,7 @@ maintainer_email 'cookbooks@lists.tfoundry.com'
license 'Apache 2.0'
description 'The OpenStack Advanced Volume Management service Cinder.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '8.3.0'
version '8.4.0'
recipe 'openstack-block-storage::api', 'Installs the cinder-api, sets up the cinder database, and cinder service/user/endpoints in keystone'
recipe 'openstack-block-storage::client', 'Install packages required for cinder client'

View File

@ -60,6 +60,8 @@ identity_endpoint = endpoint 'identity-api'
identity_admin_endpoint = endpoint 'identity-admin'
service_pass = get_password 'service', 'openstack-block-storage'
auth_uri = auth_uri_transform(identity_endpoint.to_s, node['openstack']['block-storage']['api']['auth']['version'])
execute 'cinder-manage db sync'
template '/etc/cinder/api-paste.ini' do
@ -68,7 +70,7 @@ template '/etc/cinder/api-paste.ini' do
owner node['openstack']['block-storage']['user']
mode 00644
variables(
identity_endpoint: identity_endpoint,
auth_uri: auth_uri,
identity_admin_endpoint: identity_admin_endpoint,
service_pass: service_pass
)

View File

@ -149,6 +149,15 @@ describe 'openstack-block-storage::api' do
it 'has auth_protocol' do
expect(@chef_run).to render_file(@file.name).with_content('auth_protocol = http')
end
it 'has no auth_version when auth_version is v2.0' do
expect(@chef_run).not_to render_file(@file.name).with_content('auth_version = v2.0')
end
it 'has auth_version when auth version is not v2.0' do
@chef_run.node.set['openstack']['block-storage']['api']['auth']['version'] = 'v3.0'
expect(@chef_run).to render_file(@file.name).with_content('auth_version = v3.0')
end
end
end
end

View File

@ -52,10 +52,13 @@ paste.filter_factory = cinder.api.middleware.auth:CinderKeystoneContext.factory
[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
auth_uri = <%= @identity_endpoint.to_s %>
auth_uri = <%= @auth_uri %>
auth_host = <%= @identity_admin_endpoint.host %>
auth_port = <%= @identity_admin_endpoint.port %>
auth_protocol = <%= @identity_admin_endpoint.scheme %>
<% if node['openstack']['block-storage']['api']['auth']['version'] != 'v2.0' %>
auth_version = <%= node['openstack']['block-storage']['api']['auth']['version'] %>
<% end %>
admin_tenant_name = <%= node["openstack"]["block-storage"]["service_tenant_name"] %>
admin_user = <%= node["openstack"]["block-storage"]["service_user"] %>
admin_password = <%= @service_pass %>