Merge "Add address params to the swift::keystone::auth"
This commit is contained in:
@@ -1,26 +1,41 @@
|
|||||||
class swift::keystone::auth(
|
class swift::keystone::auth(
|
||||||
$auth_name = 'swift',
|
$auth_name = 'swift',
|
||||||
$password = 'swift_password',
|
$password = 'swift_password',
|
||||||
$address = '127.0.0.1',
|
$address = '127.0.0.1',
|
||||||
$port = '8080',
|
$port = '8080',
|
||||||
$tenant = 'services',
|
$tenant = 'services',
|
||||||
$email = 'swift@localhost',
|
$email = 'swift@localhost',
|
||||||
$region = 'RegionOne',
|
$region = 'RegionOne',
|
||||||
$public_protocol = 'http',
|
$public_protocol = 'http',
|
||||||
$public_address = undef,
|
$public_address = undef,
|
||||||
$public_port = undef
|
$public_port = undef,
|
||||||
|
$admin_address = undef,
|
||||||
|
$internal_address = undef
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if ! $public_port {
|
if $address != '127.0.0.1' {
|
||||||
$real_public_port = $port
|
warning("Address parameter for swift::keystone::auth has been deprecated, use public_address instead")
|
||||||
} else {
|
|
||||||
$real_public_port = $public_port
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! $public_address {
|
if ! $public_port {
|
||||||
$real_public_address = $address
|
$real_public_port = $port
|
||||||
} else {
|
} else {
|
||||||
$real_public_address = $public_address
|
$real_public_port = $public_port
|
||||||
|
}
|
||||||
|
if ! $public_address {
|
||||||
|
$real_public_address = $address
|
||||||
|
} else {
|
||||||
|
$real_public_address = $public_address
|
||||||
|
}
|
||||||
|
if ! $admin_address {
|
||||||
|
$real_admin_address = $real_public_address
|
||||||
|
} else {
|
||||||
|
$real_admin_address = $admin_address
|
||||||
|
}
|
||||||
|
if ! $internal_address {
|
||||||
|
$real_internal_address = $real_public_address
|
||||||
|
} else {
|
||||||
|
$real_internal_address = $internal_address
|
||||||
}
|
}
|
||||||
|
|
||||||
keystone_user { $auth_name:
|
keystone_user { $auth_name:
|
||||||
@@ -43,8 +58,8 @@ class swift::keystone::auth(
|
|||||||
keystone_endpoint { "${region}/${auth_name}":
|
keystone_endpoint { "${region}/${auth_name}":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
public_url => "${public_protocol}://${real_public_address}:${real_public_port}/v1/AUTH_%(tenant_id)s",
|
public_url => "${public_protocol}://${real_public_address}:${real_public_port}/v1/AUTH_%(tenant_id)s",
|
||||||
admin_url => "http://${address}:${port}",
|
admin_url => "http://${real_admin_address}:${port}/",
|
||||||
internal_url => "http://${address}:${port}/v1/AUTH_%(tenant_id)s",
|
internal_url => "http://${real_internal_address}:${port}/v1/AUTH_%(tenant_id)s",
|
||||||
}
|
}
|
||||||
|
|
||||||
keystone_service { "${auth_name}_s3":
|
keystone_service { "${auth_name}_s3":
|
||||||
@@ -55,8 +70,8 @@ class swift::keystone::auth(
|
|||||||
keystone_endpoint { "${region}/${auth_name}_s3":
|
keystone_endpoint { "${region}/${auth_name}_s3":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
public_url => "${public_protocol}://${real_public_address}:${real_public_port}",
|
public_url => "${public_protocol}://${real_public_address}:${real_public_port}",
|
||||||
admin_url => "http://${address}:${port}",
|
admin_url => "http://${real_admin_address}:${port}",
|
||||||
internal_url => "http://${address}:${port}",
|
internal_url => "http://${real_internal_address}:${port}",
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ describe 'swift::keystone::auth' do
|
|||||||
it { should contain_keystone_endpoint('RegionOne/swift').with(
|
it { should contain_keystone_endpoint('RegionOne/swift').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:public_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s",
|
:public_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s",
|
||||||
:admin_url => "http://127.0.0.1:8080",
|
:admin_url => "http://127.0.0.1:8080/",
|
||||||
:internal_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s"
|
:internal_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s"
|
||||||
) }
|
) }
|
||||||
|
|
||||||
@@ -42,26 +42,28 @@ describe 'swift::keystone::auth' do
|
|||||||
) }
|
) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when overriding public_port and public address' do
|
describe 'when overriding public_port, public address, admin_address and internal_address' do
|
||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:public_port => '80',
|
:public_port => '80',
|
||||||
:public_address => '10.10.10.10'
|
:public_address => '10.10.10.10',
|
||||||
|
:admin_address => '10.10.10.2',
|
||||||
|
:internal_address => '127.0.0.1'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_keystone_endpoint('RegionOne/swift').with(
|
it { should contain_keystone_endpoint('RegionOne/swift').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:public_url => "http://10.10.10.10:80/v1/AUTH_%(tenant_id)s",
|
:public_url => "http://10.10.10.10:80/v1/AUTH_%(tenant_id)s",
|
||||||
:admin_url => "http://127.0.0.1:8080",
|
:admin_url => "http://10.10.10.2:8080/",
|
||||||
:internal_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s"
|
:internal_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s"
|
||||||
) }
|
) }
|
||||||
|
|
||||||
it { should contain_keystone_endpoint('RegionOne/swift_s3').with(
|
it { should contain_keystone_endpoint('RegionOne/swift_s3').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:public_url => 'http://10.10.10.10:80',
|
:public_url => 'http://10.10.10.10:80',
|
||||||
:admin_url => 'http://127.0.0.1:8080',
|
:admin_url => 'http://10.10.10.2:8080',
|
||||||
:internal_url => 'http://127.0.0.1:8080'
|
:internal_url => 'http://127.0.0.1:8080'
|
||||||
) }
|
) }
|
||||||
|
|
||||||
@@ -118,7 +120,7 @@ describe 'swift::keystone::auth' do
|
|||||||
it { should contain_keystone_endpoint('RegionOne/swift').with(
|
it { should contain_keystone_endpoint('RegionOne/swift').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:public_url => "http://192.168.0.1:8081/v1/AUTH_%(tenant_id)s",
|
:public_url => "http://192.168.0.1:8081/v1/AUTH_%(tenant_id)s",
|
||||||
:admin_url => "http://192.168.0.1:8081",
|
:admin_url => "http://192.168.0.1:8081/",
|
||||||
:internal_url => "http://192.168.0.1:8081/v1/AUTH_%(tenant_id)s"
|
:internal_url => "http://192.168.0.1:8081/v1/AUTH_%(tenant_id)s"
|
||||||
) }
|
) }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user