Skip to content

Commit 0399810

Browse files
Jenkinsopenstack-gerrit
Jenkins
authored andcommitted
Merge "Create swift operator keystone roles" into stable/havana
2 parents 942a932 + 0a73ab1 commit 0399810

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

manifests/keystone/auth.pp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# == Class: swift::keystone::auth
2+
#
3+
# This class creates keystone users, services, endpoints, and roles
4+
# for swift services.
5+
#
6+
# The user is given the admin role in the services tenant.
7+
#
8+
# === Parameters
9+
# [*auth_user*]
10+
# String. The name of the user.
11+
# Optional. Defaults to 'swift'.
12+
#
13+
# [*password*]
14+
# String. The user's password.
15+
# Optional. Defaults to 'swift_password'.
16+
#
17+
# [*operator_roles*]
18+
# Array of strings. List of roles Swift considers as admin.
19+
#
120
class swift::keystone::auth(
221
$auth_name = 'swift',
322
$password = 'swift_password',
@@ -6,6 +25,7 @@
625
$tenant = 'services',
726
$email = 'swift@localhost',
827
$region = 'RegionOne',
28+
$operator_roles = ['admin', 'SwiftOperator'],
929
$public_protocol = 'http',
1030
$public_address = undef,
1131
$public_port = undef,
@@ -73,5 +93,9 @@
7393
admin_url => "http://${real_admin_address}:${port}",
7494
internal_url => "http://${real_internal_address}:${port}",
7595
}
96+
if $operator_roles {
97+
#Roles like "admin" may be defined elsewhere, so use ensure_resource
98+
ensure_resource('keystone_role', $operator_roles, { 'ensure' => 'present' })
99+
}
76100

77101
}

manifests/proxy/keystone.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
# == Parameters
55
# [operator_roles] a list of keystone roles a user must have to gain
66
# access to Swift.
7-
# Optional. Dfeaults to ['admin', 'SwiftOperator']
7+
# Optional. Defaults to ['admin', 'SwiftOperator']
88
# Must be an array of strings
9+
# Swift operator roles must be defined in swift::keystone::auth because
10+
# keystone API access is usually not available on Swift proxy nodes.
911
# [is_admin] Set to true to allow users to set ACLs on their account.
1012
# Optional. Defaults to true.
1113
#

spec/classes/swift_keystone_auth_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
:admin_url => 'http://127.0.0.1:8080',
4141
:internal_url => 'http://127.0.0.1:8080'
4242
) }
43+
44+
['admin', 'SwiftOperator'].each do |role_name|
45+
it { should contain_keystone_role(role_name).with_ensure('present') }
46+
end
4347
end
4448

4549
describe 'when overriding public_port, public address, admin_address and internal_address' do
@@ -133,4 +137,17 @@
133137

134138
end
135139

140+
describe 'when overriding operator_roles' do
141+
142+
let :params do
143+
{
144+
:operator_roles => 'foo',
145+
}
146+
end
147+
148+
it { should contain_keystone_role('foo').with(
149+
:ensure => 'present'
150+
) }
151+
152+
end
136153
end

0 commit comments

Comments
 (0)