Make scheduler_driver configurable

No scheduler_driver will be configured if none is provided.
This commit is contained in:
Mathieu Gagné 2013-03-19 16:36:49 -04:00
parent 96e7eb3c69
commit 8f425918bf
2 changed files with 77 additions and 7 deletions

View File

@ -1,14 +1,22 @@
#
class cinder::scheduler (
$package_ensure = 'latest',
$enabled = true
$scheduler_driver = false,
$package_ensure = 'latest',
$enabled = true
) {
include cinder::params
Cinder_config<||> ~> Service['cinder-scheduler']
Cinder_api_paste_ini<||> ~> Service['cinder-scheduler']
Exec<| title == 'cinder-manage db_sync' |> ~> Service['cinder-scheduler']
if $scheduler_driver {
cinder_config {
'DEFAULT/scheduler_driver': value => $scheduler_driver;
}
}
if $::cinder::params::scheduler_package {
Package['cinder-scheduler'] -> Cinder_config<||>
Package['cinder-scheduler'] -> Cinder_api_paste_ini<||>

View File

@ -1,10 +1,72 @@
require 'spec_helper'
describe 'cinder::scheduler' do
let :facts do
{:osfamily => 'Debian'}
describe 'on debian plateforms' do
let :facts do
{ :osfamily => 'Debian' }
end
describe 'with default parameters' do
it { should include_class('cinder::params') }
it { should contain_package('cinder-scheduler').with(
:name => 'cinder-scheduler',
:ensure => 'latest',
:before => 'Service[cinder-scheduler]'
) }
it { should contain_service('cinder-scheduler').with(
:name => 'cinder-scheduler',
:enable => true,
:ensure => 'running',
:require => 'Package[cinder]',
:subscribe => 'File[/etc/cinder/cinder.conf]'
) }
end
describe 'with parameters' do
let :params do
{ :scheduler_driver => 'cinder.scheduler.filter_scheduler.FilterScheduler',
:package_ensure => 'present'
}
end
it { should contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
it { should contain_package('cinder-scheduler').with_ensure('present') }
end
end
describe 'on rhel plateforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
describe 'with default parameters' do
it { should include_class('cinder::params') }
it { should contain_service('cinder-scheduler').with(
:name => 'openstack-cinder-scheduler',
:enable => true,
:ensure => 'running',
:require => 'Package[cinder]',
:subscribe => 'File[/etc/cinder/cinder.conf]'
) }
end
describe 'with parameters' do
let :params do
{ :scheduler_driver => 'cinder.scheduler.filter_scheduler.FilterScheduler' }
end
it { should contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
end
end
it { should contain_package('cinder-scheduler') }
it { should contain_service('cinder-scheduler') }
end