keyring: use exec to manage cephkeyring group

- Add 'nova' user to 'cephkeyring' group with ensure_resource
- Add 'cinder' user to 'cephkeyring' group with ensure_resource
- Update fixtures & Puppetfile to lastest commit in puppet-cinder
  stable/havana
- Add a unit test with multiple RBD backends
This commit is contained in:
Emilien Macchi 2014-04-15 11:22:32 +02:00
parent edea0a06a5
commit af67eb64cb
4 changed files with 16 additions and 6 deletions

View File

@ -150,9 +150,10 @@ Host *
ensure => 'present'
})
@user { 'nova': groups => 'cephkeyring' }
User <| title == nova |>
realize User[nova]
ensure_resource ('exec','add-nova-to-group', {
'command' => 'usermod -a -G cephkeyring nova',
'unless' => 'groups nova | grep cephkeyring'
})
ensure_resource('file', "/etc/ceph/ceph.client.${cinder_rbd_user}.keyring", {
owner => 'root',

View File

@ -80,9 +80,10 @@ define cloud::volume::backend::rbd (
ensure => 'present'
})
@user { 'cinder': groups => 'cephkeyring' }
User <| title == cinder |>
realize User[cinder]
ensure_resource ('exec','add-cinder-to-group', {
'command' => 'usermod -a -G cephkeyring cinder',
'unless' => 'groups cinder | grep cephkeyring'
})
ensure_resource('file', "/etc/ceph/ceph.client.${rbd_user}.keyring", {
owner => 'root',

View File

@ -240,6 +240,10 @@ describe 'cloud::compute::hypervisor' do
should contain_nova_config('DEFAULT/rbd_user').with('value' => 'cinder')
should contain_nova_config('DEFAULT/rbd_secret_uuid').with('value' => 'secrete')
should contain_group('cephkeyring').with(:ensure => 'present')
should contain_exec('add-nova-to-group').with(
:command => 'usermod -a -G cephkeyring nova',
:unless => 'groups nova | grep cephkeyring'
)
end
it 'configure nova-compute with extra parameters' do

View File

@ -107,6 +107,10 @@ describe 'cloud::volume::storage' do
:os_auth_url => 'http://keystone.host:5000/v2.0'
)
should contain_group('cephkeyring').with(:ensure => 'present')
should contain_exec('add-cinder-to-group').with(
:command => 'usermod -a -G cephkeyring cinder',
:unless => 'groups cinder | grep cephkeyring'
)
end
end