Skip to content

Commit

Permalink
Update manila to a97a672d257dcb3f0f702a67965bc644ad3dcb73
Browse files Browse the repository at this point in the history
a97a672d257dcb3f0f702a67965bc644ad3dcb73 Merge "Introduce public_url, internal_url and admin_url"
070ce4aa37c44644bb13f325b05922d4182be132 Merge "Update spec_helper_acceptance for project renames"
bda00d7ecd028baa6247faa515ac56c33704ebce Update spec_helper_acceptance for project renames
9f9b269e40b588ffff77fd541a628aaaf51b8dff Introduce public_url, internal_url and admin_url

Change-Id: I0e1ac95ebc281b8bf6ab1dca81baba8a4f9b73e4
  • Loading branch information
xbezdick committed Jun 23, 2015
1 parent 898fa73 commit 659ab03
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mod 'keystone',
:git => 'https://github.com/openstack/puppet-keystone.git'

mod 'manila',
:commit => '04c9643e0e7bf7659ae063977788b4ca4504b861',
:commit => 'a97a672d257dcb3f0f702a67965bc644ad3dcb73',
:git => 'https://github.com/openstack/puppet-manila.git'

mod 'memcached',
Expand Down
163 changes: 135 additions & 28 deletions manila/manifests/keystone/auth.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,76 @@
# [*service_type*]
# Type of service. Optional. Defaults to 'share'.
#
# [*public_address*]
# Public address for endpoint. Optional. Defaults to '127.0.0.1'.
# [*region*]
# Region for endpoint. Optional. Defaults to 'RegionOne'.
#
# [*admin_address*]
# Admin address for endpoint. Optional. Defaults to '127.0.0.1'.
# [*tenant*]
# Tenant for Manila user. Optional. Defaults to 'services'.
#
# [*internal_address*]
# Internal address for endpoint. Optional. Defaults to '127.0.0.1'.
# [*public_url*]
# (optional) The endpoint's public url. (Defaults to 'http://127.0.0.1:8786/v1/%(tenant_id)s')
# This url should *not* contain any trailing '/'.
#
# [*port*]
# Port for endpoint. Optional. Defaults to '8786'.
# [*admin_url*]
# (optional) The endpoint's admin url. (Defaults to 'http://127.0.0.1:8786/v1/%(tenant_id)s')
# This url should *not* contain any trailing '/'.
#
# [*share_version*]
# Manila API version. Optional. Defaults to 'v1'.
# [*internal_url*]
# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8786/v1/%(tenant_id)s')
# This url should *not* contain any trailing '/'.
#
# [*region*]
# Region for endpoint. Optional. Defaults to 'RegionOne'.
# [*share_version*]
# (optional) DEPRECATED: Use public_url, internal_url and admin_url instead.
# API version endpoint. (Defaults to 'v1')
# Setting this parameter overrides public_url, internal_url and admin_url parameters.
#
# [*tenant*]
# Tenant for Manila user. Optional. Defaults to 'services'.
# [*port*]
# (optional) DEPRECATED: Use public_url, internal_url and admin_url instead.
# Default port for endpoints. (Defaults to 8786)
# Setting this parameter overrides public_url, internal_url and admin_url parameters.
#
# [*public_protocol*]
# Protocol for public endpoint. Optional. Defaults to 'http'.
# (optional) DEPRECATED: Use public_url instead.
# Protocol for public endpoint. (Defaults to 'http')
# Setting this parameter overrides public_url parameter.
#
# [*public_address*]
# (optional) DEPRECATED: Use public_url instead.
# Public address for endpoint. (Defaults to '127.0.0.1')
# Setting this parameter overrides public_url parameter.
#
# [*internal_protocol*]
# Protocol for internal endpoint. Optional. Defaults to 'http'.
# (optional) DEPRECATED: Use internal_url instead.
# Protocol for internal endpoint. (Defaults to 'http')
# Setting this parameter overrides internal_url parameter.
#
# [*internal_address*]
# (optional) DEPRECATED: Use internal_url instead.
# Internal address for endpoint. (Defaults to '127.0.0.1')
# Setting this parameter overrides internal_url parameter.
#
# [*admin_protocol*]
# Protocol for admin endpoint. Optional. Defaults to 'http'.
# (optional) DEPRECATED: Use admin_url instead.
# Protocol for admin endpoint. (Defaults to 'http')
# Setting this parameter overrides admin_url parameter.
#
# [*admin_address*]
# (optional) DEPRECATED: Use admin_url instead.
# Admin address for endpoint. (Defaults to '127.0.0.1')
# Setting this parameter overrides admin_url parameter.
#
# === Deprecation notes
#
# If any value is provided for public_protocol, public_address or port parameters,
# public_url will be completely ignored. The same applies for internal and admin parameters.
#
# === Examples
#
# class { 'manila::keystone::auth':
# public_url => 'https://10.0.0.10:8786/v1/%(tenant_id)s',
# internal_url => 'https://10.0.0.11:8786/v1/%(tenant_id)s',
# admin_url => 'https://10.0.0.11:8786/v1/%(tenant_id)s',
# }
#
class manila::keystone::auth (
$password,
Expand All @@ -57,17 +98,83 @@
$tenant = 'services',
$configure_endpoint = true,
$service_type = 'share',
$public_address = '127.0.0.1',
$admin_address = '127.0.0.1',
$internal_address = '127.0.0.1',
$port = '8786',
$share_version = 'v1',
$region = 'RegionOne',
$public_protocol = 'http',
$admin_protocol = 'http',
$internal_protocol = 'http'
$public_url = 'http://127.0.0.1:8786/v1/%(tenant_id)s',
$admin_url = 'http://127.0.0.1:8786/v1/%(tenant_id)s',
$internal_url = 'http://127.0.0.1:8786/v1/%(tenant_id)s',
# DEPRECATED PARAMETERS
$share_version = undef,
$port = undef,
$public_protocol = undef,
$public_address = undef,
$internal_protocol = undef,
$internal_address = undef,
$admin_protocol = undef,
$admin_address = undef,
) {

if $share_version {
warning('The share_version parameter is deprecated, use public_url, internal_url and admin_url instead.')
}

if $port {
warning('The port parameter is deprecated, use public_url, internal_url and admin_url instead.')
}

if $public_protocol {
warning('The public_protocol parameter is deprecated, use public_url instead.')
}

if $internal_protocol {
warning('The internal_protocol parameter is deprecated, use internal_url instead.')
}

if $admin_protocol {
warning('The admin_protocol parameter is deprecated, use admin_url instead.')
}

if $public_address {
warning('The public_address parameter is deprecated, use public_url instead.')
}

if $internal_address {
warning('The internal_address parameter is deprecated, use internal_url instead.')
}

if $admin_address {
warning('The admin_address parameter is deprecated, use admin_url instead.')
}

if ($public_protocol or $public_address or $port or $share_version) {
$public_url_real = sprintf('%s://%s:%s/%s/%%(tenant_id)s',
pick($public_protocol, 'http'),
pick($public_address, '127.0.0.1'),
pick($port, '8786'),
pick($share_version, 'v1'))
} else {
$public_url_real = $public_url
}

if ($admin_protocol or $admin_address or $port or $share_version) {
$admin_url_real = sprintf('%s://%s:%s/%s/%%(tenant_id)s',
pick($admin_protocol, 'http'),
pick($admin_address, '127.0.0.1'),
pick($port, '8786'),
pick($share_version, 'v1'))
} else {
$admin_url_real = $admin_url
}

if ($internal_protocol or $internal_address or $port or $share_version) {
$internal_url_real = sprintf('%s://%s:%s/%s/%%(tenant_id)s',
pick($internal_protocol, 'http'),
pick($internal_address, '127.0.0.1'),
pick($port, '8786'),
pick($share_version, 'v1'))
} else {
$internal_url_real = $internal_url
}

Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'manila-api' |>

keystone::resource::service_identity { $auth_name:
Expand All @@ -80,9 +187,9 @@
password => $password,
email => $email,
tenant => $tenant,
public_url => "${public_protocol}://${public_address}:${port}/${share_version}/%(tenant_id)s",
admin_url => "${admin_protocol}://${admin_address}:${port}/${share_version}/%(tenant_id)s",
internal_url => "${internal_protocol}://${internal_address}:${port}/${share_version}/%(tenant_id)s",
public_url => $public_url_real,
admin_url => $admin_url_real,
internal_url => $internal_url_real,
}

}
37 changes: 24 additions & 13 deletions manila/spec/classes/manila_keystone_auth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

describe 'manila::keystone::auth' do

let :req_params do
let :params do
{:password => 'pw'}
end

describe 'with only required params' do

let :params do
req_params
end

it 'should contain auth info' do

is_expected.to contain_keystone_user('manila').with(
Expand Down Expand Up @@ -40,9 +36,27 @@

end

context 'when overriding endpoint params' do
let :params do
req_params.merge(
context 'when overriding endpoint parameters' do
before do
params.merge!(
:region => 'RegionThree',
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
)
end

it { is_expected.to contain_keystone_endpoint('RegionThree/manila').with(
:ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
)}
end

context 'when deprecated endpoint parameters' do
before do
params.merge!(
:public_address => '10.0.42.1',
:admin_address => '10.0.42.2',
:internal_address => '10.0.42.3',
Expand All @@ -61,17 +75,14 @@
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
)}

end


describe 'when endpoint should not be configured' do
let :params do
req_params.merge(
before do
params.merge!(
:configure_endpoint => false
)
end
it { is_expected.to_not contain_keystone_endpoint('RegionOne/manila') }
end

end
6 changes: 3 additions & 3 deletions manila/spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => 0 }

# install puppet modules from git, use master
shell('git clone https://git.openstack.org/stackforge/puppet-openstacklib /etc/puppet/modules/openstacklib')
shell('git clone https://git.openstack.org/stackforge/puppet-openstack_extras /etc/puppet/modules/openstack_extras')
shell('git clone https://git.openstack.org/stackforge/puppet-keystone /etc/puppet/modules/keystone')
shell('git clone https://git.openstack.org/openstack/puppet-openstacklib /etc/puppet/modules/openstacklib')
shell('git clone https://git.openstack.org/openstack/puppet-openstack_extras /etc/puppet/modules/openstack_extras')
shell('git clone https://git.openstack.org/openstack/puppet-keystone /etc/puppet/modules/keystone')
# TODO(EmilienM) Cloning RabbitMQ module for now because we wait for a release including
# https://github.com/enovance/puppetlabs-rabbitmq/commit/0227f762070ffbbea3c28d6a60174de98fa4cc1c
shell('git clone https://github.com/puppetlabs/puppetlabs-rabbitmq/ /etc/puppet/modules/rabbitmq')
Expand Down

0 comments on commit 659ab03

Please sign in to comment.