Skip to content

Commit 70faac7

Browse files
committed
Add support for identity_uri.
This patch adds the ability to set a new keystone_identity_uri parameter. It also deprecates the old keystone_host, keystone_port, keystone_protocol, and keystone_auth_admin_prefix parameters. Logic is in place so that users of the deprecated settings should have a smooth upgrade process and get deprecation warnings until they adopt the new settings. Change-Id: Ideefb4d824cbd5b4b83f9eb773a75e536e3458fb
1 parent 85c742c commit 70faac7

2 files changed

Lines changed: 116 additions & 19 deletions

File tree

manifests/api.pp

Lines changed: 77 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
# Defaults to ceilometer
1616
#
1717
# [*keystone_host*]
18-
# (optional) Keystone's admin endpoint IP/Host.
18+
# (optional) DEPRECATED. Keystone's admin endpoint IP/Host.
1919
# Defaults to '127.0.0.1'
2020
#
2121
# [*keystone_port*]
22-
# (optional) Keystone's admin endpoint port.
22+
# (optional) DEPRECATED. Keystone's admin endpoint port.
2323
# Defaults to 35357
2424
#
2525
# [*keystone_auth_admin_prefix*]
26-
# (optional) 'path' to the keystone admin endpoint.
26+
# (optional) DEPRECATED. 'path' to the keystone admin endpoint.
2727
# Define to a path starting with a '/' and without trailing '/'.
2828
# Eg.: '/keystone/admin' to match keystone::wsgi::apache default.
2929
# Defaults to false (empty)
3030
#
3131
# [*keystone_protocol*]
32-
# (optional) 'http' or 'https'
32+
# (optional) DEPRECATED. 'http' or 'https'
3333
# Defaults to 'https'.
3434
#
3535
# [*keytone_user*]
@@ -48,6 +48,10 @@
4848
# (optional) Public Identity API endpoint.
4949
# Defaults to 'false'.
5050
#
51+
# [*keystone_identity_uri*]
52+
# (optional) Complete admin Identity API endpoint.
53+
# Defaults to: false
54+
#
5155
# [*host*]
5256
# (optional) The ceilometer api bind address.
5357
# Defaults to 0.0.0.0
@@ -64,16 +68,18 @@
6468
$manage_service = true,
6569
$enabled = true,
6670
$package_ensure = 'present',
67-
$keystone_host = '127.0.0.1',
68-
$keystone_port = '35357',
69-
$keystone_auth_admin_prefix = false,
70-
$keystone_protocol = 'http',
7171
$keystone_user = 'ceilometer',
7272
$keystone_tenant = 'services',
7373
$keystone_password = false,
7474
$keystone_auth_uri = false,
75+
$keystone_identity_uri = false,
7576
$host = '0.0.0.0',
76-
$port = '8777'
77+
$port = '8777',
78+
# DEPRECATED PARAMETERS
79+
$keystone_host = '127.0.0.1',
80+
$keystone_port = '35357',
81+
$keystone_auth_admin_prefix = false,
82+
$keystone_protocol = 'http',
7783
) {
7884

7985
include ceilometer::params
@@ -112,34 +118,86 @@
112118
}
113119

114120
ceilometer_config {
115-
'keystone_authtoken/auth_host' : value => $keystone_host;
116-
'keystone_authtoken/auth_port' : value => $keystone_port;
117-
'keystone_authtoken/auth_protocol' : value => $keystone_protocol;
118121
'keystone_authtoken/admin_tenant_name' : value => $keystone_tenant;
119122
'keystone_authtoken/admin_user' : value => $keystone_user;
120123
'keystone_authtoken/admin_password' : value => $keystone_password, secret => true;
121124
'api/host' : value => $host;
122125
'api/port' : value => $port;
123126
}
124127

125-
if $keystone_auth_admin_prefix {
126-
validate_re($keystone_auth_admin_prefix, '^(/.+[^/])?$')
127-
ceilometer_config {
128-
'keystone_authtoken/auth_admin_prefix': value => $keystone_auth_admin_prefix;
128+
# if both auth_uri and identity_uri are set we skip these deprecated settings entirely
129+
if !$keystone_auth_uri or !$keystone_identity_uri {
130+
131+
if $keystone_auth_admin_prefix {
132+
validate_re($keystone_auth_admin_prefix, '^(/.+[^/])?$')
133+
warning('The keystone_auth_admin_prefix parameter is deprecated. Please use auth_uri and identity_uri instead.')
134+
ceilometer_config {
135+
'keystone_authtoken/auth_admin_prefix': value => $keystone_auth_admin_prefix;
136+
}
137+
} else {
138+
ceilometer_config {
139+
'keystone_authtoken/auth_admin_prefix': ensure => absent;
140+
}
141+
}
142+
143+
if $keystone_host {
144+
warning('The keystone_host parameter is deprecated. Please use auth_uri and identity_uri instead.')
145+
ceilometer_config {
146+
'keystone_authtoken/auth_host': value => $keystone_host;
147+
}
148+
} else {
149+
ceilometer_config {
150+
'keystone_authtoken/auth_host': ensure => absent;
151+
}
152+
}
153+
154+
if $keystone_port {
155+
warning('The keystone_port parameter is deprecated. Please use auth_uri and identity_uri instead.')
156+
ceilometer_config {
157+
'keystone_authtoken/auth_port': value => $keystone_port;
158+
}
159+
} else {
160+
ceilometer_config {
161+
'keystone_authtoken/auth_port': ensure => absent;
162+
}
163+
}
164+
165+
if $keystone_protocol {
166+
warning('The keystone_protocol parameter is deprecated. Please use auth_uri and identity_uri instead.')
167+
ceilometer_config {
168+
'keystone_authtoken/auth_protocol': value => $keystone_protocol;
169+
}
170+
} else {
171+
ceilometer_config {
172+
'keystone_authtoken/auth_protocol': ensure => absent;
173+
}
129174
}
130175
} else {
131176
ceilometer_config {
132-
'keystone_authtoken/auth_admin_prefix': ensure => absent;
177+
'keystone_authtoken/auth_host' : ensure => absent;
178+
'keystone_authtoken/auth_port' : ensure => absent;
179+
'keystone_authtoken/auth_protocol' : ensure => absent;
180+
'keystone_authtoken/auth_admin_prefix' : ensure => absent;
133181
}
134182
}
135183

136184
if $keystone_auth_uri {
185+
$keystone_auth_uri_real = $keystone_auth_uri
186+
} elsif $keystone_host and $keystone_protocol {
187+
$keystone_auth_uri_real = "${keystone_protocol}://${keystone_host}:5000/"
188+
}
189+
190+
ceilometer_config {
191+
'keystone_authtoken/auth_uri': value => $keystone_auth_uri_real;
192+
}
193+
194+
if $keystone_identity_uri {
137195
ceilometer_config {
138-
'keystone_authtoken/auth_uri': value => $keystone_auth_uri;
196+
'keystone_authtoken/identity_uri': value => $keystone_identity_uri;
139197
}
140198
} else {
141199
ceilometer_config {
142-
'keystone_authtoken/auth_uri': value => "${keystone_protocol}://${keystone_host}:5000/";
200+
'keystone_authtoken/identity_uri': ensure => absent;
143201
}
144202
}
145203

spec/classes/ceilometer_api_spec.rb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,43 @@
154154
end
155155
end
156156

157+
describe "with custom keystone identity_uri" do
158+
let :facts do
159+
{ :osfamily => 'RedHat' }
160+
end
161+
before do
162+
params.merge!({
163+
:keystone_identity_uri => 'https://foo.bar:1234/',
164+
})
165+
end
166+
it 'configures identity_uri' do
167+
should contain_ceilometer_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:1234/");
168+
# since only auth_uri is set the deprecated auth parameters should
169+
# still get set in case they are still in use
170+
should contain_ceilometer_config('keystone_authtoken/auth_host').with_value('127.0.0.1');
171+
should contain_ceilometer_config('keystone_authtoken/auth_port').with_value('35357');
172+
should contain_ceilometer_config('keystone_authtoken/auth_protocol').with_value('http');
173+
end
174+
end
175+
176+
describe "with custom keystone identity_uri and auth_uri" do
177+
let :facts do
178+
{ :osfamily => 'RedHat' }
179+
end
180+
before do
181+
params.merge!({
182+
:keystone_identity_uri => 'https://foo.bar:35357/',
183+
:keystone_auth_uri => 'https://foo.bar:5000/v2.0/',
184+
})
185+
end
186+
it 'configures identity_uri and auth_uri but deprecates old auth settings' do
187+
should contain_ceilometer_config('keystone_authtoken/identity_uri').with_value("https://foo.bar:35357/");
188+
should contain_ceilometer_config('keystone_authtoken/auth_uri').with_value("https://foo.bar:5000/v2.0/");
189+
should contain_ceilometer_config('keystone_authtoken/auth_admin_prefix').with(:ensure => 'absent')
190+
should contain_ceilometer_config('keystone_authtoken/auth_port').with(:ensure => 'absent')
191+
should contain_ceilometer_config('keystone_authtoken/auth_protocol').with(:ensure => 'absent')
192+
should contain_ceilometer_config('keystone_authtoken/auth_host').with(:ensure => 'absent')
193+
end
194+
end
195+
157196
end

0 commit comments

Comments
 (0)