commit
3f8f357acc
|
@ -0,0 +1 @@
|
||||||
|
cert support has only been added for Redhat. Should this be added for Ubuntu?
|
|
@ -2,6 +2,7 @@ class nova(
|
||||||
# this is how to query all resources from our clutser
|
# this is how to query all resources from our clutser
|
||||||
$nova_cluster_id='localcluster',
|
$nova_cluster_id='localcluster',
|
||||||
$sql_connection = false,
|
$sql_connection = false,
|
||||||
|
# TODO maybe this should default to glance?
|
||||||
$image_service = 'nova.image.local.LocalImageService',
|
$image_service = 'nova.image.local.LocalImageService',
|
||||||
# these glance params should be optional
|
# these glance params should be optional
|
||||||
# this should probably just be configured as a glance client
|
# this should probably just be configured as a glance client
|
||||||
|
@ -54,7 +55,7 @@ class nova(
|
||||||
# allowing a resource to serve as a point where the configuration of nova begins
|
# allowing a resource to serve as a point where the configuration of nova begins
|
||||||
anchor { 'nova-start': }
|
anchor { 'nova-start': }
|
||||||
|
|
||||||
package { ["python-nova"]:
|
package { "python-nova":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
require => Package["python-greenlet"]
|
require => Package["python-greenlet"]
|
||||||
}
|
}
|
||||||
|
@ -78,7 +79,7 @@ class nova(
|
||||||
}
|
}
|
||||||
file { $logdir:
|
file { $logdir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
mode => '751',
|
mode => '0751',
|
||||||
}
|
}
|
||||||
file { '/etc/nova/nova.conf':
|
file { '/etc/nova/nova.conf':
|
||||||
mode => '0640',
|
mode => '0640',
|
||||||
|
@ -97,6 +98,7 @@ class nova(
|
||||||
|
|
||||||
|
|
||||||
# query out the config for our db connection
|
# query out the config for our db connection
|
||||||
|
# TODO - I am not sure if resource collection should be the default
|
||||||
if $sql_connection {
|
if $sql_connection {
|
||||||
nova_config { 'sql_connection': value => $sql_connection }
|
nova_config { 'sql_connection': value => $sql_connection }
|
||||||
} else{
|
} else{
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'nova::cert' do
|
||||||
|
|
||||||
|
let :pre_condition do
|
||||||
|
'include nova'
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'on debian platforms' do
|
||||||
|
let :facts do
|
||||||
|
{ :osfamily => 'Debian' }
|
||||||
|
end
|
||||||
|
it { should contain_service('nova-cert').with(
|
||||||
|
'name' => 'openstack-nova-cert',
|
||||||
|
'ensure' => 'stopped',
|
||||||
|
'enable' => false
|
||||||
|
)}
|
||||||
|
describe 'with enabled as true' do
|
||||||
|
let :params do
|
||||||
|
{:enabled => true}
|
||||||
|
end
|
||||||
|
it { should contain_service('nova-cert').with(
|
||||||
|
'name' => 'openstack-nova-cert',
|
||||||
|
'ensure' => 'running',
|
||||||
|
'enable' => true
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
describe 'on rhel' do
|
||||||
|
let :facts do
|
||||||
|
{ :osfamily => 'RedHat' }
|
||||||
|
end
|
||||||
|
it { should contain_service('nova-cert').with(
|
||||||
|
'name' => 'openstack-nova-cert',
|
||||||
|
'ensure' => 'stopped',
|
||||||
|
'enable' => false
|
||||||
|
)}
|
||||||
|
it { should_not contain_package('nova-network') }
|
||||||
|
end
|
||||||
|
end
|
|
@ -5,22 +5,129 @@ describe 'nova' do
|
||||||
{ :osfamily => 'Debian' }
|
{ :osfamily => 'Debian' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it do
|
describe 'with default parameters' do
|
||||||
should contain_group('nova').with(
|
it { should contain_package('python').with_ensure('present') }
|
||||||
|
it { should contain_package('python-greenlet').with(
|
||||||
|
'ensure' => 'present',
|
||||||
|
'require' => 'Package[python]'
|
||||||
|
)}
|
||||||
|
it { should contain_package('python-nova').with(
|
||||||
|
'ensure' => 'present',
|
||||||
|
'require' => 'Package[python-greenlet]'
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_group('nova').with(
|
||||||
'ensure' => 'present',
|
'ensure' => 'present',
|
||||||
'system' => 'true',
|
'system' => 'true',
|
||||||
'require' => 'Package[nova-common]'
|
'require' => 'Package[nova-common]'
|
||||||
)
|
)}
|
||||||
end
|
|
||||||
|
|
||||||
it do
|
it { should contain_user('nova').with(
|
||||||
should contain_user('nova').with(
|
|
||||||
'ensure' => 'present',
|
'ensure' => 'present',
|
||||||
'gid' => 'nova',
|
'gid' => 'nova',
|
||||||
'system' => 'true',
|
'system' => 'true',
|
||||||
'require' => 'Package[nova-common]'
|
'require' => 'Package[nova-common]'
|
||||||
)
|
) }
|
||||||
|
|
||||||
|
it { should contain_file('/var/log/nova').with(
|
||||||
|
'ensure' => 'directory',
|
||||||
|
'mode' => '0751',
|
||||||
|
'owner' => 'nova',
|
||||||
|
'group' => 'nova',
|
||||||
|
'require' => 'Package[nova-common]'
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_file('/etc/nova/nova.conf').with(
|
||||||
|
'mode' => '0640',
|
||||||
|
'owner' => 'nova',
|
||||||
|
'group' => 'nova',
|
||||||
|
'require' => 'Package[nova-common]'
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_exec('nova-db-sync').with(
|
||||||
|
'command' => '/usr/bin/nova-manage db sync',
|
||||||
|
'refreshonly' => true
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should contain_exec('networking-refresh').with(
|
||||||
|
'command' => '/sbin/ifdown -a ; /sbin/ifup -a',
|
||||||
|
'refreshonly' => true
|
||||||
|
)}
|
||||||
|
|
||||||
|
it { should_not contain_nova_config('sql_connection') }
|
||||||
|
|
||||||
|
it { should contain_nova_config('verbose').with_value(false) }
|
||||||
|
it { should contain_nova_config('nodaemon').with_value('false') }
|
||||||
|
it { should contain_nova_config('logdir').with_value('/var/log/nova') }
|
||||||
|
it { should contain_nova_config('image_service').with_value('nova.image.local.LocalImageService') }
|
||||||
|
it { should contain_nova_config('allow_admin_api').with_value('false') }
|
||||||
|
it { should contain_nova_config('rabbit_host').with_value('localhost') }
|
||||||
|
it { should contain_nova_config('rabbit_password').with_value('guest') }
|
||||||
|
it { should contain_nova_config('rabbit_port').with_value('5672') }
|
||||||
|
it { should contain_nova_config('rabbit_userid').with_value('guest') }
|
||||||
|
it { should contain_nova_config('rabbit_virtual_host').with_value('/') }
|
||||||
|
it { should contain_nova_config('state_path').with_value('/var/lib/nova') }
|
||||||
|
it { should contain_nova_config('lock_path').with_value('/var/lock/nova') }
|
||||||
|
it { should contain_nova_config('service_down_time').with_value('60') }
|
||||||
|
|
||||||
|
it { should contain_nova_config('network_manager').with_value('nova.network.manager.FlatManager') }
|
||||||
|
it { should_not contain_nova_config('dhcpbridge').with_value('/usr/bin/nova-dhcpbridge') }
|
||||||
|
it { should_not contain_nova_config('dhcpbridge_flagfile').with_value('/etc/nova/nova.conf') }
|
||||||
|
it { should contain_nova_config('flat_network_bridge').with_value('br100') }
|
||||||
|
|
||||||
|
it { should contain_nova_config('use_deprecated_auth').with_value('true') }
|
||||||
|
it { should contain_nova_config('root_helper').with_value('sudo') }
|
||||||
|
|
||||||
|
describe 'with parameters supplied' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
'sql_connection' => 'mysql://user:pass@db/db',
|
||||||
|
'verbose' => true,
|
||||||
|
'nodaemon' => true,
|
||||||
|
'logdir' => '/var/log/nova2',
|
||||||
|
'image_service' => 'nova.image.glance.GlanceImageService',
|
||||||
|
'allow_admin_api' => true,
|
||||||
|
'rabbit_host' => 'rabbit',
|
||||||
|
'rabbit_userid' => 'rabbit_user',
|
||||||
|
'rabbit_port' => '5672',
|
||||||
|
'rabbit_password' => 'password',
|
||||||
|
'lock_path' => '/var/locky/path',
|
||||||
|
'state_path' => '/var/lib/nova2',
|
||||||
|
'service_down_time' => '120',
|
||||||
|
'network_manager' => 'nova.network.manager.FlatDHCPManager'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it { should contain_nova_config('sql_connection').with_value('mysql://user:pass@db/db') }
|
||||||
|
|
||||||
|
it { should contain_nova_config('verbose').with_value(true) }
|
||||||
|
it { should contain_nova_config('nodaemon').with_value(true) }
|
||||||
|
it { should contain_nova_config('logdir').with_value('/var/log/nova2') }
|
||||||
|
# glance config
|
||||||
|
it { should contain_nova_config('image_service').with_value('nova.image.glance.GlanceImageService') }
|
||||||
|
it { should contain_nova_config('glance_api_servers').with_value('localhost:9292') }
|
||||||
|
it { should contain_nova_config('glance_host').with_value('localhost') }
|
||||||
|
it { should contain_nova_config('glance_port').with_value('9292') }
|
||||||
|
|
||||||
|
it { should contain_nova_config('allow_admin_api').with_value(true) }
|
||||||
|
it { should contain_nova_config('rabbit_host').with_value('rabbit') }
|
||||||
|
it { should contain_nova_config('rabbit_password').with_value('password') }
|
||||||
|
it { should contain_nova_config('rabbit_port').with_value('5672') }
|
||||||
|
it { should contain_nova_config('rabbit_userid').with_value('rabbit_user') }
|
||||||
|
it { should contain_nova_config('rabbit_virtual_host').with_value('/') }
|
||||||
|
it { should contain_nova_config('state_path').with_value('/var/lib/nova2') }
|
||||||
|
it { should contain_nova_config('lock_path').with_value('/var/locky/path') }
|
||||||
|
it { should contain_nova_config('service_down_time').with_value('120') }
|
||||||
|
|
||||||
|
it { should contain_nova_config('network_manager').with_value('nova.network.manager.FlatDHCPManager') }
|
||||||
|
it { should contain_nova_config('dhcpbridge').with_value('/usr/bin/nova-dhcpbridge') }
|
||||||
|
it { should contain_nova_config('dhcpbridge_flagfile').with_value('/etc/nova/nova.conf') }
|
||||||
|
|
||||||
|
it { should contain_nova_config('use_deprecated_auth').with_value(true) }
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
describe "When platform is RedHat" do
|
describe "When platform is RedHat" do
|
||||||
let :facts do
|
let :facts do
|
||||||
{:osfamily => 'RedHat'}
|
{:osfamily => 'RedHat'}
|
||||||
|
@ -30,4 +137,5 @@ describe 'nova' do
|
||||||
'ensure' => 'present'
|
'ensure' => 'present'
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue