Merge "Use common resource to manage keystone resources"

This commit is contained in:
Zuul 2024-01-09 12:10:31 +00:00 committed by Gerrit Code Review
commit 67888b7f3c
2 changed files with 33 additions and 45 deletions

View File

@ -66,31 +66,24 @@ class ceph::rgw::keystone::auth (
include openstacklib::openstackclient
ensure_resource('keystone_service', "${service_name}::${service_type}", {
'ensure' => 'present',
'description' => $service_description,
} )
Keystone::Resource::Service_identity['rgw'] -> Service<| tag == 'ceph-radosgw' |>
ensure_resource('keystone_endpoint', "${region}/${service_name}::${service_type}", {
'ensure' => 'present',
'public_url' => $public_url,
'admin_url' => $admin_url,
'internal_url' => $internal_url,
} )
keystone_user { $user:
ensure => present,
keystone::resource::service_identity { 'rgw':
configure_user => true,
configure_user_role => true,
configure_endpoint => true,
service_name => $service_name,
service_type => $service_type,
service_description => $service_description,
region => $region,
auth_name => $user,
password => $password,
email => $email,
}
ensure_resource('keystone_role', $roles, {
'ensure' => 'present'
} )
keystone_user_role { "${user}@${tenant}":
ensure => present,
tenant => $tenant,
roles => $roles,
public_url => $public_url,
internal_url => $internal_url,
admin_url => $admin_url,
}
}

View File

@ -13,28 +13,23 @@ describe 'ceph::rgw::keystone::auth' do
it {
should contain_class('openstacklib::openstackclient')
should contain_keystone_service('swift::object-store').with(
:ensure => 'present',
:description => 'Ceph RGW Service',
)
should contain_keystone_endpoint('RegionOne/swift::object-store').with(
:ensure => 'present',
should contain_keystone__resource__service_identity('rgw').with(
:configure_user => true,
:configure_endpoint => true,
:configure_user_role => true,
:service_name => 'swift',
:service_type => 'object-store',
:service_description => 'Ceph RGW Service',
:region => 'RegionOne',
:auth_name => 'rgw_user',
:password => 'rgw_password',
:email => 'rgwuser@localhost',
:tenant => 'services',
:roles => ['admin'],
:public_url => 'http://127.0.0.1:8080/swift/v1',
:admin_url => 'http://127.0.0.1:8080/swift/v1',
:internal_url => 'http://127.0.0.1:8080/swift/v1',
)
should contain_keystone_user('rgw_user').with(
:ensure => 'present',
:password => 'rgw_password',
:email => 'rgwuser@localhost',
)
should contain_keystone_role('admin').with(
:ensure => 'present',
)
should contain_keystone_user_role('rgw_user@services').with(
:ensure => 'present',
:roles => ['admin'],
)
}
end