# [*keystone_port*]
# keystone's admin endpoint port. Optional. Defaults to 35357
#
+# [*keystone_auth_admin_prefix*]
+# 'path' to the keystone admin endpoint. Optional. Defaults to false (empty)
+# Define to a path starting with a '/' and without trailing '/'.
+# Eg.: '/keystone/admin' to match keystone::wsgi::apache default.
+#
# [*keystone_protocol*] http/https
# Optional. Defaults to https
#
# Mandatory.
#
class ceilometer::api (
- $enabled = true,
- $keystone_host = '127.0.0.1',
- $keystone_port = '35357',
- $keystone_protocol = 'http',
- $keystone_user = 'ceilometer',
- $keystone_tenant = 'services',
- $keystone_password = false,
+ $enabled = true,
+ $keystone_host = '127.0.0.1',
+ $keystone_port = '35357',
+ $keystone_auth_admin_prefix = false,
+ $keystone_protocol = 'http',
+ $keystone_user = 'ceilometer',
+ $keystone_tenant = 'services',
+ $keystone_password = false,
) {
include ceilometer::params
'keystone_authtoken/admin_user' : value => $keystone_user;
'keystone_authtoken/admin_password' : value => $keystone_password;
}
+
+ if $keystone_auth_admin_prefix {
+ validate_re($keystone_auth_admin_prefix, '^(/.+[^/])?$')
+ ceilometer_config {
+ 'keystone_authtoken/auth_admin_prefix': value => $keystone_auth_admin_prefix;
+ }
+ } else {
+ ceilometer_config {
+ 'keystone_authtoken/auth_admin_prefix': ensure => absent;
+ }
+ }
+
}
should contain_ceilometer_config('keystone_authtoken/admin_tenant_name').with_value( params[:keystone_tenant] )
should contain_ceilometer_config('keystone_authtoken/admin_user').with_value( params[:keystone_user] )
should contain_ceilometer_config('keystone_authtoken/admin_password').with_value( params[:keystone_password] )
+ should contain_ceilometer_config('keystone_authtoken/auth_admin_prefix').with_ensure('absent')
+ end
+
+ context 'when specifying keystone_auth_admin_prefix' do
+ describe 'with a correct value' do
+ before { params['keystone_auth_admin_prefix'] = '/keystone/admin' }
+ it { should contain_ceilometer_config('keystone_authtoken/auth_admin_prefix').with_value('/keystone/admin') }
+ end
+
+ [
+ '/keystone/',
+ 'keystone/',
+ 'keystone',
+ '/keystone/admin/',
+ 'keystone/admin/',
+ 'keystone/admin'
+ ].each do |auth_admin_prefix|
+ describe "with an incorrect value #{auth_admin_prefix}" do
+ before { params['keystone_auth_admin_prefix'] = auth_admin_prefix }
+
+ it { expect { should contain_ceilomete_config('keystone_authtoken/auth_admin_prefix') }.to \
+ raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
+ end
+ end
end
end