Skip to content

Commit

Permalink
Merge "Make user creation optional when creating service."
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Sep 29, 2014
2 parents 879f872 + 55c122c commit 0a97d98
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 11 deletions.
32 changes: 21 additions & 11 deletions manifests/roles/admin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# [ignore_default_tenant] Ignore setting the default tenant value when the user is created. Optional. Defaults to false.
# [admin_tenant_desc] Optional. Description for admin tenant, defaults to 'admin tenant'
# [service_tenant_desc] Optional. Description for admin tenant, defaults to 'Tenant for the openstack services'
# [configure_user] Optional. Should the admin user be created? Defaults to 'true'.
# [configure_user_role] Optional. Should the admin role be configured for the admin user? Defaulst to 'true'.
#
# == Dependencies
# == Examples
Expand All @@ -37,6 +39,8 @@
$ignore_default_tenant = false,
$admin_tenant_desc = 'admin tenant',
$service_tenant_desc = 'Tenant for the openstack services',
$configure_user = true,
$configure_user_role = true,
) {

keystone_tenant { $service_tenant:
Expand All @@ -49,20 +53,26 @@
enabled => true,
description => $admin_tenant_desc,
}
keystone_user { $admin:
ensure => present,
enabled => true,
tenant => $admin_tenant,
email => $email,
password => $password,
ignore_default_tenant => $ignore_default_tenant,
}
keystone_role { 'admin':
ensure => present,
}
keystone_user_role { "${admin}@${admin_tenant}":
ensure => present,
roles => 'admin',

if $configure_user {
keystone_user { $admin:
ensure => present,
enabled => true,
tenant => $admin_tenant,
email => $email,
password => $password,
ignore_default_tenant => $ignore_default_tenant,
}
}

if $configure_user_role {
keystone_user_role { "${admin}@${admin_tenant}":
ensure => present,
roles => 'admin',
}
}

}
27 changes: 27 additions & 0 deletions spec/classes/keystone_roles_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,31 @@

end

describe 'when disabling user configuration' do
before do
let :params do
{
:configure_user => false
}
end

it { should_not contain_keystone_user('keystone') }
it { should contain_keystone_user_role('keystone@openstack') }
end
end

describe 'when disabling user and role configuration' do
before do
let :params do
{
:configure_user => false,
:configure_user_role => false
}
end

it { should_not contain_keystone_user('keystone') }
it { should_not contain_keystone_user_role('keystone@openstack') }
end
end

end

0 comments on commit 0a97d98

Please sign in to comment.