require sections are specified in nova_config

This massive code commit actually implements something very simple.

previously, we allowed nova_config to omit a section and assumed that
section was default.

This commit updates the code to require section names for all settings.

This change is being made b/c:
- it better maps to the config on disk
- it is consistent with the other modules

Change-Id: Iae71a4c48ed0f9792566f16f0bf13e61569b46e5
This commit is contained in:
Dan Bode
2013-04-12 15:00:50 -07:00
parent 258e4f41a7
commit c9757ec448
38 changed files with 306 additions and 301 deletions

View File

@@ -6,16 +6,14 @@ Puppet::Type.type(:nova_config).provide(
# the setting is always default # the setting is always default
# this if for backwards compat with the old puppet providers for nova_config # this if for backwards compat with the old puppet providers for nova_config
def section def section
section_setting = resource[:name].split('/', 2) resource[:name].split('/', 2)[0]
section_setting.size == 2 ? section_setting.first : 'DEFAULT'
end end
# assumes that the name was the setting # assumes that the name was the setting
# this is to maintain backwards compat with the the older # this is to maintain backwards compat with the the older
# stuff # stuff
def setting def setting
section_setting = resource[:name].split('/', 2) resource[:name].split('/', 2)[1]
section_setting.size == 2 ? section_setting.last : resource[:name]
end end
def separator def separator

View File

@@ -7,7 +7,11 @@ Puppet::Type.newtype(:nova_config) do
ensurable ensurable
newparam(:name, :namevar => true) do newparam(:name, :namevar => true) do
newvalues(/^\S+$/, /\S+\/\S+/) validate do |value|
unless value =~ /\S+\/\S+/
fail("Invalid nova_config #{value}, entries without sections are no longer supported, please add an explicit section (probably DEFAULT) to all nova_config resources")
end
end
end end
newproperty(:value) do newproperty(:value) do

View File

@@ -50,13 +50,13 @@ class nova::api(
} }
nova_config { nova_config {
'api_paste_config': value => '/etc/nova/api-paste.ini'; 'DEFAULT/api_paste_config': value => '/etc/nova/api-paste.ini';
'enabled_apis': value => $enabled_apis; 'DEFAULT/enabled_apis': value => $enabled_apis;
'volume_api_class': value => $volume_api_class; 'DEFAULT/volume_api_class': value => $volume_api_class;
'ec2_listen': value => $api_bind_address; 'DEFAULT/ec2_listen': value => $api_bind_address;
'osapi_compute_listen': value => $api_bind_address; 'DEFAULT/osapi_compute_listen': value => $api_bind_address;
'metadata_listen': value => $api_bind_address; 'DEFAULT/metadata_listen': value => $api_bind_address;
'osapi_volume_listen': value => $api_bind_address; 'DEFAULT/osapi_volume_listen': value => $api_bind_address;
} }
nova_paste_api_ini { nova_paste_api_ini {

View File

@@ -19,14 +19,14 @@ class nova::compute(
$vncproxy_base_url = "${vncproxy_protocol}://${vncproxy_host}:${vncproxy_port}${vncproxy_path}" $vncproxy_base_url = "${vncproxy_protocol}://${vncproxy_host}:${vncproxy_port}${vncproxy_path}"
# config for vnc proxy # config for vnc proxy
nova_config { nova_config {
'novncproxy_base_url': value => $vncproxy_base_url; 'DEFAULT/novncproxy_base_url': value => $vncproxy_base_url;
} }
} }
} }
nova_config { nova_config {
'vnc_enabled': value => $vnc_enabled; 'DEFAULT/vnc_enabled': value => $vnc_enabled;
'vncserver_proxyclient_address': value => $vncserver_proxyclient_address; 'DEFAULT/vncserver_proxyclient_address': value => $vncserver_proxyclient_address;
} }
package { 'bridge-utils': package { 'bridge-utils':
@@ -44,7 +44,7 @@ class nova::compute(
if $virtio_nic { if $virtio_nic {
# Enable the virtio network card for instances # Enable the virtio network card for instances
nova_config { 'libvirt_use_virtio_for_bridges': value => 'True' } nova_config { 'DEFAULT/libvirt_use_virtio_for_bridges': value => 'True' }
} }
} }

View File

@@ -46,9 +46,9 @@ class nova::compute::libvirt (
} }
nova_config { nova_config {
'compute_driver': value => 'libvirt.LibvirtDriver'; 'DEFAULT/compute_driver': value => 'libvirt.LibvirtDriver';
'libvirt_type': value => $libvirt_type; 'DEFAULT/libvirt_type': value => $libvirt_type;
'connection_type': value => 'libvirt'; 'DEFAULT/connection_type': value => 'libvirt';
'vncserver_listen': value => $vncserver_listen; 'DEFAULT/vncserver_listen': value => $vncserver_listen;
} }
} }

View File

@@ -3,8 +3,7 @@ class nova::compute::quantum (
){ ){
nova_config { nova_config {
'libvirt_vif_driver': value => $libvirt_vif_driver; 'DEFAULT/libvirt_vif_driver': value => $libvirt_vif_driver;
#'libvirt_vif_driver': value => 'nova.virt.libvirt.vif.LibvirtHybirdOVSBridgeDriver'; 'DEFAULT/libvirt_use_virtio_for_bridges': value => 'True';
'libvirt_use_virtio_for_bridges': value => 'True';
} }
} }

View File

@@ -6,11 +6,11 @@ class nova::compute::xenserver(
) { ) {
nova_config { nova_config {
'connection_type': value => 'xenapi'; 'DEFAULT/connection_type': value => 'xenapi';
'xenapi_connection_url': value => $xenapi_connection_url; 'DEFAULT/xenapi_connection_url': value => $xenapi_connection_url;
'xenapi_connection_username': value => $xenapi_connection_username; 'DEFAULT/xenapi_connection_username': value => $xenapi_connection_username;
'xenapi_connection_password': value => $xenapi_connection_password; 'DEFAULT/xenapi_connection_password': value => $xenapi_connection_password;
'xenapi_inject_image': value => $xenapi_inject_image; 'DEFAULT/xenapi_inject_image': value => $xenapi_inject_image;
} }
package { 'xenapi': package { 'xenapi':

View File

@@ -151,74 +151,74 @@ class nova(
} else { } else {
fail("Invalid db connection ${sql_connection}") fail("Invalid db connection ${sql_connection}")
} }
nova_config { 'sql_connection': value => $sql_connection } nova_config { 'DEFAULT/sql_connection': value => $sql_connection }
} }
nova_config { 'image_service': value => $image_service } nova_config { 'DEFAULT/image_service': value => $image_service }
if $image_service == 'nova.image.glance.GlanceImageService' { if $image_service == 'nova.image.glance.GlanceImageService' {
if $glance_api_servers { if $glance_api_servers {
nova_config { 'glance_api_servers': value => $glance_api_servers } nova_config { 'DEFAULT/glance_api_servers': value => $glance_api_servers }
} }
} }
nova_config { 'auth_strategy': value => $auth_strategy } nova_config { 'DEFAULT/auth_strategy': value => $auth_strategy }
if $rpc_backend == 'nova.openstack.common.rpc.impl_kombu' { if $rpc_backend == 'nova.openstack.common.rpc.impl_kombu' {
# I may want to support exporting and collecting these # I may want to support exporting and collecting these
nova_config { nova_config {
'rabbit_password': value => $rabbit_password; 'DEFAULT/rabbit_password': value => $rabbit_password;
'rabbit_userid': value => $rabbit_userid; 'DEFAULT/rabbit_userid': value => $rabbit_userid;
'rabbit_virtual_host': value => $rabbit_virtual_host; 'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host;
} }
if size($rabbit_hosts) > 1 { if size($rabbit_hosts) > 1 {
nova_config { 'rabbit_ha_queues': value => 'true' } nova_config { 'DEFAULT/rabbit_ha_queues': value => 'true' }
} else { } else {
nova_config { 'rabbit_ha_queues': value => 'false' } nova_config { 'DEFAULT/rabbit_ha_queues': value => 'false' }
} }
if $rabbit_hosts { if $rabbit_hosts {
nova_config { 'rabbit_hosts': value => join($rabbit_hosts, ',') } nova_config { 'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ',') }
} elsif $rabbit_host { } elsif $rabbit_host {
nova_config { 'rabbit_host': value => $rabbit_host } nova_config { 'DEFAULT/rabbit_host': value => $rabbit_host }
nova_config { 'rabbit_port': value => $rabbit_port } nova_config { 'DEFAULT/rabbit_port': value => $rabbit_port }
nova_config { 'rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" } nova_config { 'DEFAULT/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" }
} }
} }
if $rpc_backend == 'nova.openstack.common.rpc.impl_qpid' { if $rpc_backend == 'nova.openstack.common.rpc.impl_qpid' {
nova_config { nova_config {
'qpid_hostname': value => $qpid_hostname; 'DEFAULT/qpid_hostname': value => $qpid_hostname;
'qpid_port': value => $qpid_port; 'DEFAULT/qpid_port': value => $qpid_port;
'qpid_username': value => $qpid_username; 'DEFAULT/qpid_username': value => $qpid_username;
'qpid_password': value => $qpid_password; 'DEFAULT/qpid_password': value => $qpid_password;
'qpid_reconnect': value => $qpid_reconnect; 'DEFAULT/qpid_reconnect': value => $qpid_reconnect;
'qpid_reconnect_timeout': value => $qpid_reconnect_timeout; 'DEFAULT/qpid_reconnect_timeout': value => $qpid_reconnect_timeout;
'qpid_reconnect_limit': value => $qpid_reconnect_limit; 'DEFAULT/qpid_reconnect_limit': value => $qpid_reconnect_limit;
'qpid_reconnect_interval_min': value => $qpid_reconnect_interval_min; 'DEFAULT/qpid_reconnect_interval_min': value => $qpid_reconnect_interval_min;
'qpid_reconnect_interval_max': value => $qpid_reconnect_interval_max; 'DEFAULT/qpid_reconnect_interval_max': value => $qpid_reconnect_interval_max;
'qpid_reconnect_interval': value => $qpid_reconnect_interval; 'DEFAULT/qpid_reconnect_interval': value => $qpid_reconnect_interval;
'qpid_heartbeat': value => $qpid_heartbeat; 'DEFAULT/qpid_heartbeat': value => $qpid_heartbeat;
'qpid_protocol': value => $qpid_protocol; 'DEFAULT/qpid_protocol': value => $qpid_protocol;
'qpid_tcp_nodelay': value => $qpid_tcp_nodelay; 'DEFAULT/qpid_tcp_nodelay': value => $qpid_tcp_nodelay;
} }
} }
nova_config { nova_config {
'verbose': value => $verbose; 'DEFAULT/verbose': value => $verbose;
'logdir': value => $logdir; 'DEFAULT/logdir': value => $logdir;
'rpc_backend': value => $rpc_backend; 'DEFAULT/rpc_backend': value => $rpc_backend;
# Following may need to be broken out to different nova services # Following may need to be broken out to different nova services
'state_path': value => $state_path; 'DEFAULT/state_path': value => $state_path;
'lock_path': value => $lock_path; 'DEFAULT/lock_path': value => $lock_path;
'service_down_time': value => $service_down_time; 'DEFAULT/service_down_time': value => $service_down_time;
'rootwrap_config': value => $rootwrap_config; 'DEFAULT/rootwrap_config': value => $rootwrap_config;
} }
if $monitoring_notifications { if $monitoring_notifications {
nova_config { nova_config {
'notification_driver': value => 'nova.notifier.rabbit_notifier' 'DEFAULT/notification_driver': value => 'nova.notifier.rabbit_notifier'
} }
} }

View File

@@ -40,7 +40,7 @@ class nova::network(
} }
if $floating_range { if $floating_range {
nova_config { 'floating_range': value => $floating_range } nova_config { 'DEFAULT/floating_range': value => $floating_range }
} }
if has_key($config_overrides, 'vlan_start') { if has_key($config_overrides, 'vlan_start') {

View File

@@ -14,7 +14,7 @@ define nova::network::bridge ( $ip, $netmask = "255.255.255.0" )
"set iface[. = '${name}']/method static", "set iface[. = '${name}']/method static",
"set iface[. = '${name}']/address ${ip}", "set iface[. = '${name}']/address ${ip}",
"set iface[. = '${name}']/netmask ${netmask}", "set iface[. = '${name}']/netmask ${netmask}",
"set iface[. = '${name}']/bridge_ports none", "set iface[. = '${name}']/bridge_ports none",
], ],
notify => Exec["networking-refresh"], notify => Exec["networking-refresh"],
} }

View File

@@ -10,14 +10,14 @@ class nova::network::flat (
) { ) {
if $public_interface { if $public_interface {
nova_config { 'public_interface': value => $public_interface } nova_config { 'DEFAULT/public_interface': value => $public_interface }
} }
nova_config { nova_config {
'network_manager': value => 'nova.network.manager.FlatManager'; 'DEFAULT/network_manager': value => 'nova.network.manager.FlatManager';
'fixed_range': value => $fixed_range; 'DEFAULT/fixed_range': value => $fixed_range;
'flat_interface': value => $flat_interface; 'DEFAULT/flat_interface': value => $flat_interface;
'flat_network_bridge': value => $flat_network_bridge; 'DEFAULT/flat_network_bridge': value => $flat_network_bridge;
} }
} }

View File

@@ -12,20 +12,20 @@ class nova::network::flatdhcp (
) { ) {
if $public_interface { if $public_interface {
nova_config { 'public_interface': value => $public_interface } nova_config { 'DEFAULT/public_interface': value => $public_interface }
} }
nova_config { nova_config {
'network_manager': value => 'nova.network.manager.FlatDHCPManager'; 'DEFAULT/network_manager': value => 'nova.network.manager.FlatDHCPManager';
'fixed_range': value => $fixed_range; 'DEFAULT/fixed_range': value => $fixed_range;
'flat_interface': value => $flat_interface; 'DEFAULT/flat_interface': value => $flat_interface;
'flat_network_bridge': value => $flat_network_bridge; 'DEFAULT/flat_network_bridge': value => $flat_network_bridge;
#'flat_dhcp_start': value => $flat_dhcp_start; #'flat_dhcp_start': value => $flat_dhcp_start;
'force_dhcp_release': value => $force_dhcp_release; 'DEFAULT/force_dhcp_release': value => $force_dhcp_release;
'flat_injected': value => $flat_injected; 'DEFAULT/flat_injected': value => $flat_injected;
'dhcp_domain': value => $dhcp_domain; 'DEFAULT/dhcp_domain': value => $dhcp_domain;
'dhcpbridge': value => $dhcpbridge; 'DEFAULT/dhcpbridge': value => $dhcpbridge;
'dhcpbridge_flagfile': value => $dhcpbridge_flagfile; 'DEFAULT/dhcpbridge_flagfile': value => $dhcpbridge_flagfile;
} }
} }

View File

@@ -21,22 +21,22 @@ class nova::network::quantum (
) { ) {
if $public_interface { if $public_interface {
nova_config { 'public_interface': value => $public_interface } nova_config { 'DEFAULT/public_interface': value => $public_interface }
} }
if $quantum_host != 'localhost' { if $quantum_host != 'localhost' {
nova_config { 'quantum_connection_host': value => $quantum_connection_host } nova_config { 'DEFAULT/quantum_connection_host': value => $quantum_connection_host }
} }
nova_config { nova_config {
'fixed_range': value => $fixed_range; 'DEFAULT/fixed_range': value => $fixed_range;
'quantum_use_dhcp': value => $use_dhcp; 'DEFAULT/quantum_use_dhcp': value => $use_dhcp;
'quantum_auth_strategy': value => $quantum_auth_strategy; 'DEFAULT/quantum_auth_strategy': value => $quantum_auth_strategy;
'network_api_class': value => 'nova.network.quantumv2.api.API'; 'DEFAULT/network_api_class': value => 'nova.network.quantumv2.api.API';
'quantum_url': value => $quantum_url; 'DEFAULT/quantum_url': value => $quantum_url;
'quantum_admin_tenant_name': value => $quantum_admin_tenant_name; 'DEFAULT/quantum_admin_tenant_name': value => $quantum_admin_tenant_name;
'quantum_admin_username': value => $quantum_admin_username; 'DEFAULT/quantum_admin_username': value => $quantum_admin_username;
'quantum_admin_password': value => $quantum_admin_password; 'DEFAULT/quantum_admin_password': value => $quantum_admin_password;
'quantum_admin_auth_url': value => $quantum_admin_auth_url; 'DEFAULT/quantum_admin_auth_url': value => $quantum_admin_auth_url;
} }
} }

View File

@@ -11,18 +11,18 @@ class nova::network::vlan (
) { ) {
if $public_interface { if $public_interface {
nova_config { 'public_interface': value => $public_interface } nova_config { 'DEFAULT/public_interface': value => $public_interface }
} }
nova_config { nova_config {
'network_manager': value => 'nova.network.manager.VlanManager'; 'DEFAULT/network_manager': value => 'nova.network.manager.VlanManager';
'fixed_range': value => $fixed_range; 'DEFAULT/fixed_range': value => $fixed_range;
'vlan_interface': value => $vlan_interface; 'DEFAULT/vlan_interface': value => $vlan_interface;
'vlan_start': value => $vlan_start; 'DEFAULT/vlan_start': value => $vlan_start;
'force_dhcp_release': value => $force_dhcp_release; 'DEFAULT/force_dhcp_release': value => $force_dhcp_release;
'dhcp_domain': value => $dhcp_domain; 'DEFAULT/dhcp_domain': value => $dhcp_domain;
'dhcpbridge': value => $dhcpbridge; 'DEFAULT/dhcpbridge': value => $dhcpbridge;
'dhcpbridge_flagfile': value => $dhcpbridge_flagfile; 'DEFAULT/dhcpbridge_flagfile': value => $dhcpbridge_flagfile;
} }
} }

View File

@@ -19,22 +19,22 @@ class nova::quota(
) { ) {
nova_config { nova_config {
'quota_instances': value => $quota_instances; 'DEFAULT/quota_instances': value => $quota_instances;
'quota_cores': value => $quota_cores; 'DEFAULT/quota_cores': value => $quota_cores;
'quota_ram': value => $quota_ram; 'DEFAULT/quota_ram': value => $quota_ram;
'quota_volumes': value => $quota_volumes; 'DEFAULT/quota_volumes': value => $quota_volumes;
'quota_gigabytes': value => $quota_gigabytes; 'DEFAULT/quota_gigabytes': value => $quota_gigabytes;
'quota_floating_ips': value => $quota_floating_ips; 'DEFAULT/quota_floating_ips': value => $quota_floating_ips;
'quota_metadata_items': value => $quota_metadata_items; 'DEFAULT/quota_metadata_items': value => $quota_metadata_items;
'quota_max_injected_files': value => $quota_max_injected_files; 'DEFAULT/quota_max_injected_files': value => $quota_max_injected_files;
'quota_max_injected_file_content_bytes': value => $quota_max_injected_file_content_bytes; 'DEFAULT/quota_max_injected_file_content_bytes': value => $quota_max_injected_file_content_bytes;
'quota_max_injected_file_path_bytes': value => $quota_max_injected_file_path_bytes; 'DEFAULT/quota_max_injected_file_path_bytes': value => $quota_max_injected_file_path_bytes;
'quota_security_groups': value => $quota_security_groups; 'DEFAULT/quota_security_groups': value => $quota_security_groups;
'quota_security_group_rules': value => $quota_security_group_rules; 'DEFAULT/quota_security_group_rules': value => $quota_security_group_rules;
'quota_key_pairs': value => $quota_key_pairs; 'DEFAULT/quota_key_pairs': value => $quota_key_pairs;
'reservation_expire': value => $reservation_expire; 'DEFAULT/reservation_expire': value => $reservation_expire;
'max_age': value => $max_age; 'DEFAULT/max_age': value => $max_age;
'quota_driver': value => $quota_driver 'DEFAULT/quota_driver': value => $quota_driver
} }
} }

View File

@@ -15,8 +15,8 @@ class nova::vncproxy(
# See http://nova.openstack.org/runnova/vncconsole.html for more details. # See http://nova.openstack.org/runnova/vncconsole.html for more details.
nova_config { nova_config {
'novncproxy_host': value => $host; 'DEFAULT/novncproxy_host': value => $host;
'novncproxy_port': value => $port; 'DEFAULT/novncproxy_port': value => $port;
} }
package { 'python-numpy': package { 'python-numpy':

View File

@@ -26,10 +26,10 @@ class nova::volume::iscsi (
include 'nova::params' include 'nova::params'
nova_config { 'volume_group': value => $volume_group } nova_config { 'DEFAULT/volume_group': value => $volume_group }
if $iscsi_ip_address { if $iscsi_ip_address {
nova_config { 'iscsi_ip_address': value => $iscsi_ip_address } nova_config { 'DEFAULT/iscsi_ip_address': value => $iscsi_ip_address }
} }
case $iscsi_helper { case $iscsi_helper {
@@ -46,7 +46,7 @@ class nova::volume::iscsi (
require => [Nova::Generic_service['volume'], Package['tgt']], require => [Nova::Generic_service['volume'], Package['tgt']],
} }
# This is the default, but might as well be verbose # This is the default, but might as well be verbose
nova_config { 'iscsi_helper': value => 'tgtadm' } nova_config { 'DEFAULT/iscsi_helper': value => 'tgtadm' }
} }
'iscsitarget': { 'iscsitarget': {

View File

@@ -20,18 +20,18 @@ class nova::volume::san (
) { ) {
if $san_private_key { if $san_private_key {
nova_config { 'san_private_key': value => $san_private_key } nova_config { 'DEFAULT/san_private_key': value => $san_private_key }
} else { } else {
nova_config { nova_config {
'san_login': value => $san_login; 'DEFAULT/san_login': value => $san_login;
'san_password': value => $san_password; 'DEFAULT/san_password': value => $san_password;
} }
} }
nova_config { nova_config {
'volume_driver': value => $volume_driver; 'DEFAULT/volume_driver': value => $volume_driver;
'san_ip': value => $san_ip; 'DEFAULT/san_ip': value => $san_ip;
'san_clustername': value => $san_clustername; 'DEFAULT/san_clustername': value => $san_clustername;
} }
} }

View File

@@ -57,10 +57,10 @@ describe 'nova::api' do
should contain_nova_paste_api_ini( should contain_nova_paste_api_ini(
'filter:authtoken/admin_password').with_value('passw0rd') 'filter:authtoken/admin_password').with_value('passw0rd')
end end
it { should contain_nova_config('ec2_listen').with('value' => '0.0.0.0') } it { should contain_nova_config('DEFAULT/ec2_listen').with('value' => '0.0.0.0') }
it { should contain_nova_config('osapi_compute_listen').with('value' => '0.0.0.0') } it { should contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '0.0.0.0') }
it { should contain_nova_config('metadata_listen').with('value' => '0.0.0.0') } it { should contain_nova_config('DEFAULT/metadata_listen').with('value' => '0.0.0.0') }
it { should contain_nova_config('osapi_volume_listen').with('value' => '0.0.0.0') } it { should contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '0.0.0.0') }
end end
describe 'with params' do describe 'with params' do
let :params do let :params do
@@ -90,10 +90,10 @@ describe 'nova::api' do
should contain_nova_paste_api_ini( should contain_nova_paste_api_ini(
'filter:authtoken/admin_password').with_value('passw0rd2') 'filter:authtoken/admin_password').with_value('passw0rd2')
end end
it { should contain_nova_config('ec2_listen').with('value' => '192.168.56.210') } it { should contain_nova_config('DEFAULT/ec2_listen').with('value' => '192.168.56.210') }
it { should contain_nova_config('osapi_compute_listen').with('value' => '192.168.56.210') } it { should contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '192.168.56.210') }
it { should contain_nova_config('metadata_listen').with('value' => '192.168.56.210') } it { should contain_nova_config('DEFAULT/metadata_listen').with('value' => '192.168.56.210') }
it { should contain_nova_config('osapi_volume_listen').with('value' => '192.168.56.210') } it { should contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '192.168.56.210') }
end end
end end
describe 'on rhel' do describe 'on rhel' do

View File

@@ -32,10 +32,10 @@ describe 'nova::compute::libvirt' do
:before => 'Service[nova-compute]' :before => 'Service[nova-compute]'
)} )}
it { should contain_nova_config('compute_driver').with_value('libvirt.LibvirtDriver')} it { should contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')}
it { should contain_nova_config('libvirt_type').with_value('kvm')} it { should contain_nova_config('DEFAULT/libvirt_type').with_value('kvm')}
it { should contain_nova_config('connection_type').with_value('libvirt')} it { should contain_nova_config('DEFAULT/connection_type').with_value('libvirt')}
it { should contain_nova_config('vncserver_listen').with_value('127.0.0.1')} it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('127.0.0.1')}
end end
describe 'with params' do describe 'with params' do
@@ -45,8 +45,8 @@ describe 'nova::compute::libvirt' do
} }
end end
it { should contain_nova_config('libvirt_type').with_value('qemu')} it { should contain_nova_config('DEFAULT/libvirt_type').with_value('qemu')}
it { should contain_nova_config('vncserver_listen').with_value('0.0.0.0')} it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('0.0.0.0')}
end end
describe 'with migration_support enabled' do describe 'with migration_support enabled' do
@@ -58,7 +58,7 @@ describe 'nova::compute::libvirt' do
end end
it { should include_class('nova::migration::libvirt')} it { should include_class('nova::migration::libvirt')}
it { should contain_nova_config('vncserver_listen').with_value('0.0.0.0')} it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('0.0.0.0')}
end end
context 'with vncserver_listen not set to 0.0.0.0' do context 'with vncserver_listen not set to 0.0.0.0' do
@@ -102,10 +102,10 @@ describe 'nova::compute::libvirt' do
:provider => 'init' :provider => 'init'
) } ) }
it { should contain_nova_config('compute_driver').with_value('libvirt.LibvirtDriver')} it { should contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')}
it { should contain_nova_config('libvirt_type').with_value('kvm')} it { should contain_nova_config('DEFAULT/libvirt_type').with_value('kvm')}
it { should contain_nova_config('connection_type').with_value('libvirt')} it { should contain_nova_config('DEFAULT/connection_type').with_value('libvirt')}
it { should contain_nova_config('vncserver_listen').with_value('127.0.0.1')} it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('127.0.0.1')}
end end
describe 'with params' do describe 'with params' do
@@ -115,8 +115,8 @@ describe 'nova::compute::libvirt' do
} }
end end
it { should contain_nova_config('libvirt_type').with_value('qemu')} it { should contain_nova_config('DEFAULT/libvirt_type').with_value('qemu')}
it { should contain_nova_config('vncserver_listen').with_value('0.0.0.0')} it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('0.0.0.0')}
end end
describe 'with migration_support enabled' do describe 'with migration_support enabled' do
@@ -128,7 +128,7 @@ describe 'nova::compute::libvirt' do
end end
it { should include_class('nova::migration::libvirt')} it { should include_class('nova::migration::libvirt')}
it { should contain_nova_config('vncserver_listen').with_value('0.0.0.0')} it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('0.0.0.0')}
end end
context 'with vncserver_listen not set to 0.0.0.0' do context 'with vncserver_listen not set to 0.0.0.0' do
@@ -162,10 +162,10 @@ describe 'nova::compute::libvirt' do
:before => 'Service[nova-compute]' :before => 'Service[nova-compute]'
)} )}
it { should contain_nova_config('compute_driver').with_value('libvirt.LibvirtDriver')} it { should contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')}
it { should contain_nova_config('libvirt_type').with_value('kvm')} it { should contain_nova_config('DEFAULT/libvirt_type').with_value('kvm')}
it { should contain_nova_config('connection_type').with_value('libvirt')} it { should contain_nova_config('DEFAULT/connection_type').with_value('libvirt')}
it { should contain_nova_config('vncserver_listen').with_value('127.0.0.1')} it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('127.0.0.1')}
end end
end end

View File

@@ -1,14 +1,14 @@
require 'spec_helper' require 'spec_helper'
describe 'nova::compute::quantum' do describe 'nova::compute::quantum' do
it { should contain_nova_config('libvirt_use_virtio_for_bridges').with_value('True')} it { should contain_nova_config('DEFAULT/libvirt_use_virtio_for_bridges').with_value('True')}
it { should contain_nova_config('libvirt_vif_driver').with_value('nova.virt.libvirt.vif.LibvirtOpenVswitchDriver')} it { should contain_nova_config('DEFAULT/libvirt_vif_driver').with_value('nova.virt.libvirt.vif.LibvirtOpenVswitchDriver')}
context 'when overriding params' do context 'when overriding params' do
let :params do let :params do
{:libvirt_vif_driver => 'foo' } {:libvirt_vif_driver => 'foo' }
end end
it { should contain_nova_config('libvirt_vif_driver').with_value('foo')} it { should contain_nova_config('DEFAULT/libvirt_vif_driver').with_value('foo')}
end end
end end

View File

@@ -19,9 +19,9 @@ describe 'nova::compute' do
{ :osfamily => 'Debian' } { :osfamily => 'Debian' }
end end
it { should contain_nova_config('vnc_enabled').with_value('true') } it { should contain_nova_config('DEFAULT/vnc_enabled').with_value('true') }
it { should contain_nova_config('vncserver_proxyclient_address').with_value('127.0.0.1') } it { should contain_nova_config('DEFAULT/vncserver_proxyclient_address').with_value('127.0.0.1') }
it { should contain_nova_config('novncproxy_base_url').with_value( it { should contain_nova_config('DEFAULT/novncproxy_base_url').with_value(
'http://127.0.0.1:6080/vnc_auto.html' 'http://127.0.0.1:6080/vnc_auto.html'
) } ) }
@@ -59,9 +59,9 @@ describe 'nova::compute' do
{:vnc_enabled => false} {:vnc_enabled => false}
end end
it { should contain_nova_config('vnc_enabled').with_value('false') } it { should contain_nova_config('DEFAULT/vnc_enabled').with_value('false') }
it { should contain_nova_config('vncserver_proxyclient_address').with_value('127.0.0.1')} it { should contain_nova_config('DEFAULT/vncserver_proxyclient_address').with_value('127.0.0.1')}
it { should_not contain_nova_config('novncproxy_base_url') } it { should_not contain_nova_config('DEFAULT/novncproxy_base_url') }
end end
describe 'with package version' do describe 'with package version' do

View File

@@ -18,8 +18,8 @@ describe 'nova::consoleauth' do
it { should contain_package('nova-consoleauth').with( it { should contain_package('nova-consoleauth').with(
'ensure' => '2012.1-2' 'ensure' => '2012.1-2'
)} )}
end end
end end
end end

View File

@@ -9,12 +9,12 @@ describe 'nova::db::mysql' do
let :facts do let :facts do
{ :osfamily => "Debian" } { :osfamily => "Debian" }
end end
context 'with only required parameters' do context 'with only required parameters' do
let :params do let :params do
required_params required_params
end end
it { should contain_mysql__db('nova').with( it { should contain_mysql__db('nova').with(
:user => 'nova', :user => 'nova',
:password => 'qwerty', :password => 'qwerty',
@@ -22,12 +22,12 @@ describe 'nova::db::mysql' do
:require => "Class[Mysql::Config]" :require => "Class[Mysql::Config]"
)} )}
end end
context 'when overriding charset' do context 'when overriding charset' do
let :params do let :params do
{ :charset => 'utf8' }.merge(required_params) { :charset => 'utf8' }.merge(required_params)
end end
it { should contain_mysql__db('nova').with_charset(params[:charset]) } it { should contain_mysql__db('nova').with_charset(params[:charset]) }
end end
end end
@@ -36,12 +36,12 @@ describe 'nova::db::mysql' do
let :facts do let :facts do
{ :osfamily => 'RedHat' } { :osfamily => 'RedHat' }
end end
context 'with only required parameters' do context 'with only required parameters' do
let :params do let :params do
required_params required_params
end end
it { should contain_mysql__db('nova').with( it { should contain_mysql__db('nova').with(
:user => 'nova', :user => 'nova',
:password => 'qwerty', :password => 'qwerty',
@@ -49,12 +49,12 @@ describe 'nova::db::mysql' do
:require => "Class[Mysql::Config]" :require => "Class[Mysql::Config]"
)} )}
end end
context 'when overriding charset' do context 'when overriding charset' do
let :params do let :params do
{ :charset => 'utf8' }.merge(required_params) { :charset => 'utf8' }.merge(required_params)
end end
it { should contain_mysql__db('nova').with_charset(params[:charset]) } it { should contain_mysql__db('nova').with_charset(params[:charset]) }
end end
end end

View File

@@ -54,30 +54,30 @@ describe 'nova' do
'refreshonly' => true 'refreshonly' => true
)} )}
it { should_not contain_nova_config('sql_connection') } it { should_not contain_nova_config('DEFAULT/sql_connection') }
it { should contain_nova_config('image_service').with_value('nova.image.glance.GlanceImageService') } it { should contain_nova_config('DEFAULT/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('DEFAULT/glance_api_servers').with_value('localhost:9292') }
it { should contain_nova_config('auth_strategy').with_value('keystone') } it { should contain_nova_config('DEFAULT/auth_strategy').with_value('keystone') }
it { should_not contain_nova_config('use_deprecated_auth').with_value('false') } it { should_not contain_nova_config('DEFAULT/use_deprecated_auth').with_value('false') }
it { should contain_nova_config('rpc_backend').with_value('nova.openstack.common.rpc.impl_kombu') } it { should contain_nova_config('DEFAULT/rpc_backend').with_value('nova.openstack.common.rpc.impl_kombu') }
it { should contain_nova_config('rabbit_host').with_value('localhost') } it { should contain_nova_config('DEFAULT/rabbit_host').with_value('localhost') }
it { should contain_nova_config('rabbit_password').with_value('guest') } it { should contain_nova_config('DEFAULT/rabbit_password').with_value('guest') }
it { should contain_nova_config('rabbit_port').with_value('5672') } it { should contain_nova_config('DEFAULT/rabbit_port').with_value('5672') }
it { should contain_nova_config('rabbit_hosts').with_value('localhost:5672') } it { should contain_nova_config('DEFAULT/rabbit_hosts').with_value('localhost:5672') }
it { should contain_nova_config('rabbit_ha_queues').with_value('false') } it { should contain_nova_config('DEFAULT/rabbit_ha_queues').with_value('false') }
it { should contain_nova_config('rabbit_userid').with_value('guest') } it { should contain_nova_config('DEFAULT/rabbit_userid').with_value('guest') }
it { should contain_nova_config('rabbit_virtual_host').with_value('/') } it { should contain_nova_config('DEFAULT/rabbit_virtual_host').with_value('/') }
it { should contain_nova_config('DEFAULT/verbose').with_value(false) }
it { should contain_nova_config('DEFAULT/logdir').with_value('/var/log/nova') }
it { should contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova') }
it { should contain_nova_config('DEFAULT/lock_path').with_value('/var/lock/nova') }
it { should contain_nova_config('DEFAULT/service_down_time').with_value('60') }
it { should contain_nova_config('DEFAULT/rootwrap_config').with_value('/etc/nova/rootwrap.conf') }
it { should contain_nova_config('verbose').with_value(false) }
it { should contain_nova_config('logdir').with_value('/var/log/nova') }
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('rootwrap_config').with_value('/etc/nova/rootwrap.conf') }
describe 'with parameters supplied' do describe 'with parameters supplied' do
@@ -101,27 +101,27 @@ describe 'nova' do
it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') } it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') }
it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') } it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') }
it { should contain_nova_config('sql_connection').with_value('mysql://user:pass@db/db') } it { should contain_nova_config('DEFAULT/sql_connection').with_value('mysql://user:pass@db/db') }
it { should contain_nova_config('image_service').with_value('nova.image.local.LocalImageService') } it { should contain_nova_config('DEFAULT/image_service').with_value('nova.image.local.LocalImageService') }
it { should_not contain_nova_config('glance_api_servers') } it { should_not contain_nova_config('DEFAULT/glance_api_servers') }
it { should contain_nova_config('auth_strategy').with_value('foo') } it { should contain_nova_config('DEFAULT/auth_strategy').with_value('foo') }
it { should_not contain_nova_config('use_deprecated_auth').with_value(true) } it { should_not contain_nova_config('DEFAULT/use_deprecated_auth').with_value(true) }
it { should contain_nova_config('rpc_backend').with_value('nova.openstack.common.rpc.impl_kombu') } it { should contain_nova_config('DEFAULT/rpc_backend').with_value('nova.openstack.common.rpc.impl_kombu') }
it { should contain_nova_config('rabbit_host').with_value('rabbit') } it { should contain_nova_config('DEFAULT/rabbit_host').with_value('rabbit') }
it { should contain_nova_config('rabbit_password').with_value('password') } it { should contain_nova_config('DEFAULT/rabbit_password').with_value('password') }
it { should contain_nova_config('rabbit_port').with_value('5673') } it { should contain_nova_config('DEFAULT/rabbit_port').with_value('5673') }
it { should contain_nova_config('rabbit_userid').with_value('rabbit_user') } it { should contain_nova_config('DEFAULT/rabbit_userid').with_value('rabbit_user') }
it { should contain_nova_config('rabbit_virtual_host').with_value('/') } it { should contain_nova_config('DEFAULT/rabbit_virtual_host').with_value('/') }
it { should contain_nova_config('rabbit_hosts').with_value('rabbit:5673') } it { should contain_nova_config('DEFAULT/rabbit_hosts').with_value('rabbit:5673') }
it { should contain_nova_config('rabbit_ha_queues').with_value('false') } it { should contain_nova_config('DEFAULT/rabbit_ha_queues').with_value('false') }
it { should contain_nova_config('verbose').with_value(true) } it { should contain_nova_config('DEFAULT/verbose').with_value(true) }
it { should contain_nova_config('logdir').with_value('/var/log/nova2') } it { should contain_nova_config('DEFAULT/logdir').with_value('/var/log/nova2') }
it { should contain_nova_config('state_path').with_value('/var/lib/nova2') } it { should contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova2') }
it { should contain_nova_config('lock_path').with_value('/var/locky/path') } it { should contain_nova_config('DEFAULT/lock_path').with_value('/var/locky/path') }
it { should contain_nova_config('service_down_time').with_value('120') } it { should contain_nova_config('DEFAULT/service_down_time').with_value('120') }
end end
@@ -133,10 +133,10 @@ describe 'nova' do
} }
end end
it { should_not contain_nova_config('rabbit_host') } it { should_not contain_nova_config('DEFAULT/rabbit_host') }
it { should_not contain_nova_config('rabbit_port') } it { should_not contain_nova_config('DEFAULT/rabbit_port') }
it { should contain_nova_config('rabbit_hosts').with_value('rabbit:5673,rabbit2:5674') } it { should contain_nova_config('DEFAULT/rabbit_hosts').with_value('rabbit:5673,rabbit2:5674') }
it { should contain_nova_config('rabbit_ha_queues').with_value('true') } it { should contain_nova_config('DEFAULT/rabbit_ha_queues').with_value('true') }
end end
@@ -160,33 +160,33 @@ describe 'nova' do
it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') } it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') }
it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') } it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') }
it { should contain_nova_config('sql_connection').with_value('mysql://user:pass@db/db') } it { should contain_nova_config('DEFAULT/sql_connection').with_value('mysql://user:pass@db/db') }
it { should contain_nova_config('image_service').with_value('nova.image.local.LocalImageService') } it { should contain_nova_config('DEFAULT/image_service').with_value('nova.image.local.LocalImageService') }
it { should_not contain_nova_config('glance_api_servers') } it { should_not contain_nova_config('DEFAULT/glance_api_servers') }
it { should contain_nova_config('auth_strategy').with_value('foo') } it { should contain_nova_config('DEFAULT/auth_strategy').with_value('foo') }
it { should_not contain_nova_config('use_deprecated_auth').with_value(true) } it { should_not contain_nova_config('DEFAULT/use_deprecated_auth').with_value(true) }
it { should contain_nova_config('rpc_backend').with_value('nova.openstack.common.rpc.impl_qpid') } it { should contain_nova_config('DEFAULT/rpc_backend').with_value('nova.openstack.common.rpc.impl_qpid') }
it { should contain_nova_config('qpid_hostname').with_value('localhost') } it { should contain_nova_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { should contain_nova_config('qpid_port').with_value('5672') } it { should contain_nova_config('DEFAULT/qpid_port').with_value('5672') }
it { should contain_nova_config('qpid_username').with_value('guest') } it { should contain_nova_config('DEFAULT/qpid_username').with_value('guest') }
it { should contain_nova_config('qpid_password').with_value('guest') } it { should contain_nova_config('DEFAULT/qpid_password').with_value('guest') }
it { should contain_nova_config('qpid_reconnect').with_value('true') } it { should contain_nova_config('DEFAULT/qpid_reconnect').with_value('true') }
it { should contain_nova_config('qpid_reconnect_timeout').with_value('0') } it { should contain_nova_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
it { should contain_nova_config('qpid_reconnect_limit').with_value('0') } it { should contain_nova_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
it { should contain_nova_config('qpid_reconnect_interval_min').with_value('0') } it { should contain_nova_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
it { should contain_nova_config('qpid_reconnect_interval_max').with_value('0') } it { should contain_nova_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
it { should contain_nova_config('qpid_reconnect_interval').with_value('0') } it { should contain_nova_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
it { should contain_nova_config('qpid_heartbeat').with_value('60') } it { should contain_nova_config('DEFAULT/qpid_heartbeat').with_value('60') }
it { should contain_nova_config('qpid_protocol').with_value('tcp') } it { should contain_nova_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { should contain_nova_config('qpid_tcp_nodelay').with_value('true') } it { should contain_nova_config('DEFAULT/qpid_tcp_nodelay').with_value('true') }
it { should contain_nova_config('verbose').with_value(true) } it { should contain_nova_config('DEFAULT/verbose').with_value(true) }
it { should contain_nova_config('logdir').with_value('/var/log/nova2') } it { should contain_nova_config('DEFAULT/logdir').with_value('/var/log/nova2') }
it { should contain_nova_config('state_path').with_value('/var/lib/nova2') } it { should contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova2') }
it { should contain_nova_config('lock_path').with_value('/var/locky/path') } it { should contain_nova_config('DEFAULT/lock_path').with_value('/var/locky/path') }
it { should contain_nova_config('service_down_time').with_value('120') } it { should contain_nova_config('DEFAULT/service_down_time').with_value('120') }
end end
@@ -198,7 +198,7 @@ describe 'nova' do
'name' => 'openstack-nova-common', 'name' => 'openstack-nova-common',
'ensure' => 'present' 'ensure' => 'present'
)} )}
it { should contain_nova_config('rootwrap_config').with_value('/etc/nova/rootwrap.conf') } it { should contain_nova_config('DEFAULT/rootwrap_config').with_value('/etc/nova/rootwrap.conf') }
end end
end end
end end

View File

@@ -10,11 +10,11 @@ describe 'nova::network::flat' do
} }
end end
it { should contain_nova_config('network_manager').with_value('nova.network.manager.FlatManager') } it { should contain_nova_config('DEFAULT/network_manager').with_value('nova.network.manager.FlatManager') }
it { should_not contain_nova_config('public_interface') } it { should_not contain_nova_config('DEFAULT/public_interface') }
it { should contain_nova_config('fixed_range').with_value('10.0.0.0/32') } it { should contain_nova_config('DEFAULT/fixed_range').with_value('10.0.0.0/32') }
it { should contain_nova_config('flat_network_bridge').with_value('br100') } it { should contain_nova_config('DEFAULT/flat_network_bridge').with_value('br100') }
it { should contain_nova_config('flat_interface').with_value('eth1') } it { should contain_nova_config('DEFAULT/flat_interface').with_value('eth1') }
end end
describe 'when overriding class parameters' do describe 'when overriding class parameters' do
@@ -28,11 +28,11 @@ describe 'nova::network::flat' do
} }
end end
it { should contain_nova_config('public_interface').with_value('eth0') } it { should contain_nova_config('DEFAULT/public_interface').with_value('eth0') }
it { should contain_nova_config('flat_network_bridge').with_value('br1001') } it { should contain_nova_config('DEFAULT/flat_network_bridge').with_value('br1001') }
it { should contain_nova_config('fixed_range').with_value('10.0.0.0/32') } it { should contain_nova_config('DEFAULT/fixed_range').with_value('10.0.0.0/32') }
it { should contain_nova_config('flat_interface').with_value('eth1') } it { should contain_nova_config('DEFAULT/flat_interface').with_value('eth1') }
end end
end end

View File

@@ -10,16 +10,16 @@ describe 'nova::network::flatdhcp' do
} }
end end
it { should contain_nova_config('network_manager').with_value('nova.network.manager.FlatDHCPManager') } it { should contain_nova_config('DEFAULT/network_manager').with_value('nova.network.manager.FlatDHCPManager') }
it { should_not contain_nova_config('public_interface') } it { should_not contain_nova_config('DEFAULT/public_interface') }
it { should contain_nova_config('fixed_range').with_value('10.0.0.0/32') } it { should contain_nova_config('DEFAULT/fixed_range').with_value('10.0.0.0/32') }
it { should contain_nova_config('flat_interface').with_value('eth1') } it { should contain_nova_config('DEFAULT/flat_interface').with_value('eth1') }
it { should contain_nova_config('flat_interface').with_value('eth1') } it { should contain_nova_config('DEFAULT/flat_interface').with_value('eth1') }
it { should contain_nova_config('flat_network_bridge').with_value('br100') } it { should contain_nova_config('DEFAULT/flat_network_bridge').with_value('br100') }
it { should contain_nova_config('force_dhcp_release').with_value('true') } it { should contain_nova_config('DEFAULT/force_dhcp_release').with_value('true') }
it { should contain_nova_config('flat_injected').with_value('false') } it { should contain_nova_config('DEFAULT/flat_injected').with_value('false') }
it { should contain_nova_config('dhcpbridge').with_value('/usr/bin/nova-dhcpbridge') } it { should contain_nova_config('DEFAULT/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('DEFAULT/dhcpbridge_flagfile').with_value('/etc/nova/nova.conf') }
end end
describe 'when overriding class parameters' do describe 'when overriding class parameters' do
@@ -33,17 +33,17 @@ describe 'nova::network::flatdhcp' do
:force_dhcp_release => false, :force_dhcp_release => false,
:flat_injected => true, :flat_injected => true,
:dhcpbridge => '/usr/bin/dhcpbridge', :dhcpbridge => '/usr/bin/dhcpbridge',
:dhcpbridge_flagfile => '/etc/nova/nova-dhcp.conf' :dhcpbridge_flagfile => '/etc/nova/nova-dhcp.conf'
} }
end end
it { should contain_nova_config('public_interface').with_value('eth0') } it { should contain_nova_config('DEFAULT/public_interface').with_value('eth0') }
it { should contain_nova_config('flat_network_bridge').with_value('br1001') } it { should contain_nova_config('DEFAULT/flat_network_bridge').with_value('br1001') }
it { should contain_nova_config('force_dhcp_release').with_value('false') } it { should contain_nova_config('DEFAULT/force_dhcp_release').with_value('false') }
it { should contain_nova_config('flat_injected').with_value('true') } it { should contain_nova_config('DEFAULT/flat_injected').with_value('true') }
it { should contain_nova_config('dhcpbridge').with_value('/usr/bin/dhcpbridge') } it { should contain_nova_config('DEFAULT/dhcpbridge').with_value('/usr/bin/dhcpbridge') }
it { should contain_nova_config('dhcpbridge_flagfile').with_value('/etc/nova/nova-dhcp.conf') } it { should contain_nova_config('DEFAULT/dhcpbridge_flagfile').with_value('/etc/nova/nova-dhcp.conf') }
end end
end end

View File

@@ -88,7 +88,7 @@ describe 'nova::network' do
let :params do let :params do
default_params.merge(:floating_range => '10.0.0.0/30') default_params.merge(:floating_range => '10.0.0.0/30')
end end
it { should contain_nova_config('floating_range').with_value('10.0.0.0/30') } it { should contain_nova_config('DEFAULT/floating_range').with_value('10.0.0.0/30') }
it { should contain_nova__manage__floating('nova-vm-floating').with_network('10.0.0.0/30') } it { should contain_nova__manage__floating('nova-vm-floating').with_network('10.0.0.0/30') }
end end
end end

View File

@@ -10,14 +10,14 @@ describe 'nova::network::vlan' do
} }
end end
it { should contain_nova_config('network_manager').with_value('nova.network.manager.VlanManager') } it { should contain_nova_config('DEFAULT/network_manager').with_value('nova.network.manager.VlanManager') }
it { should_not contain_nova_config('public_interface') } it { should_not contain_nova_config('DEFAULT/public_interface') }
it { should contain_nova_config('fixed_range').with_value('10.0.0.0/32') } it { should contain_nova_config('DEFAULT/fixed_range').with_value('10.0.0.0/32') }
it { should contain_nova_config('vlan_start').with_value('300') } it { should contain_nova_config('DEFAULT/vlan_start').with_value('300') }
it { should contain_nova_config('vlan_interface').with_value('eth1') } it { should contain_nova_config('DEFAULT/vlan_interface').with_value('eth1') }
it { should contain_nova_config('force_dhcp_release').with_value('true') } it { should contain_nova_config('DEFAULT/force_dhcp_release').with_value('true') }
it { should contain_nova_config('dhcpbridge').with_value('/usr/bin/nova-dhcpbridge') } it { should contain_nova_config('DEFAULT/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('DEFAULT/dhcpbridge_flagfile').with_value('/etc/nova/nova.conf') }
end end
@@ -35,13 +35,13 @@ describe 'nova::network::vlan' do
} }
end end
it { should contain_nova_config('network_manager').with_value('nova.network.manager.VlanManager') } it { should contain_nova_config('DEFAULT/network_manager').with_value('nova.network.manager.VlanManager') }
it { should contain_nova_config('public_interface').with_value('eth0') } it { should contain_nova_config('DEFAULT/public_interface').with_value('eth0') }
it { should contain_nova_config('fixed_range').with_value('10.0.0.0/32') } it { should contain_nova_config('DEFAULT/fixed_range').with_value('10.0.0.0/32') }
it { should contain_nova_config('vlan_start').with_value('100') } it { should contain_nova_config('DEFAULT/vlan_start').with_value('100') }
it { should contain_nova_config('vlan_interface').with_value('eth1') } it { should contain_nova_config('DEFAULT/vlan_interface').with_value('eth1') }
it { should contain_nova_config('force_dhcp_release').with_value('false') } it { should contain_nova_config('DEFAULT/force_dhcp_release').with_value('false') }
it { should contain_nova_config('dhcpbridge').with_value('/usr/bin/dhcpbridge') } it { should contain_nova_config('DEFAULT/dhcpbridge').with_value('/usr/bin/dhcpbridge') }
it { should contain_nova_config('dhcpbridge_flagfile').with_value('/etc/nova/nova-dhcp.conf') } it { should contain_nova_config('DEFAULT/dhcpbridge_flagfile').with_value('/etc/nova/nova-dhcp.conf') }
end end
end end

View File

@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'nova::quota' do describe 'nova::quota' do
it { should contain_nova_config('quota_ram').with_value('51200') } it { should contain_nova_config('DEFAULT/quota_ram').with_value('51200') }
describe 'when overriding params' do describe 'when overriding params' do
@@ -10,7 +10,7 @@ describe 'nova::quota' do
{:quota_ram => '1'} {:quota_ram => '1'}
end end
it { should contain_nova_config('quota_ram').with_value('1') } it { should contain_nova_config('DEFAULT/quota_ram').with_value('1') }
end end

View File

@@ -20,8 +20,8 @@ describe 'nova::vncproxy' do
:name => 'python-numpy' :name => 'python-numpy'
)} )}
it { should contain_nova_config('novncproxy_host').with(:value => '0.0.0.0') } it { should contain_nova_config('DEFAULT/novncproxy_host').with(:value => '0.0.0.0') }
it { should contain_nova_config('novncproxy_port').with(:value => '6080') } it { should contain_nova_config('DEFAULT/novncproxy_port').with(:value => '6080') }
it { should contain_package('nova-vncproxy').with( it { should contain_package('nova-vncproxy').with(
:name => ["novnc", "nova-novncproxy"], :name => ["novnc", "nova-novncproxy"],

View File

@@ -39,8 +39,8 @@ describe 'nova::volume::iscsi' do
it { should contain_file('/etc/default/iscsitarget') } it { should contain_file('/etc/default/iscsitarget') }
end end
it { should contain_nova_config('volume_group').with_value('nova-volumes') } it { should contain_nova_config('DEFAULT/volume_group').with_value('nova-volumes') }
it { should_not contain_nova_config('iscsi_ip_address') } it { should_not contain_nova_config('DEFAULT/iscsi_ip_address') }
end end

View File

@@ -20,7 +20,7 @@ describe provider_class do
it 'should default to the default setting when no other one is specified' do it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Nova_config.new( resource = Puppet::Type::Nova_config.new(
{:name => 'foo', :value => 'bar'} {:name => 'DEFAULT/foo', :value => 'bar'}
) )
provider = provider_class.new(resource) provider = provider_class.new(resource)
provider.section.should == 'DEFAULT' provider.section.should == 'DEFAULT'

View File

@@ -2,7 +2,7 @@ require 'puppet'
require 'puppet/type/nova_config' require 'puppet/type/nova_config'
describe 'Puppet::Type.type(:nova_config)' do describe 'Puppet::Type.type(:nova_config)' do
before :each do before :each do
@nova_config = Puppet::Type.type(:nova_config).new(:name => 'foo', :value => 'bar') @nova_config = Puppet::Type.type(:nova_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end end
it 'should require a name' do it 'should require a name' do
expect { expect {
@@ -12,14 +12,19 @@ describe 'Puppet::Type.type(:nova_config)' do
it 'should not expect a name with whitespace' do it 'should not expect a name with whitespace' do
expect { expect {
Puppet::Type.type(:nova_config).new(:name => 'f oo') Puppet::Type.type(:nova_config).new(:name => 'f oo')
}.to raise_error(Puppet::Error, /Invalid value/) }.to raise_error(Puppet::Error, /Invalid nova_config/)
end
it 'should fail when there is no section' do
expect {
Puppet::Type.type(:nova_config).new(:name => 'foo')
}.to raise_error(Puppet::Error, /entries without sections are no longer supported/)
end end
it 'should not require a value when ensure is absent' do it 'should not require a value when ensure is absent' do
Puppet::Type.type(:nova_config).new(:name => 'foo', :ensure => :absent) Puppet::Type.type(:nova_config).new(:name => 'DEFAULT/foo', :ensure => :absent)
end end
it 'should require a value when ensure is present' do it 'should require a value when ensure is present' do
expect { expect {
Puppet::Type.type(:nova_config).new(:name => 'foo', :ensure => :present) Puppet::Type.type(:nova_config).new(:name => 'DEFAULT/foo', :ensure => :present)
}.to raise_error(Puppet::Error, /Property value must be set/) }.to raise_error(Puppet::Error, /Property value must be set/)
end end
it 'should accept a valid value' do it 'should accept a valid value' do

View File

@@ -1,8 +1,8 @@
class { 'nova': class { 'nova':
sql_connection => 'mysql://root:<password>@127.0.0.1/nova', sql_connection => 'mysql://root:<password>@127.0.0.1/nova',
} }
class { 'mysql::server': class { 'mysql::server':
root_password => 'password' root_password => 'password'
} }
class { 'nova::db': class { 'nova::db':
password => 'password', password => 'password',

View File

@@ -1,9 +1,9 @@
resources { 'nova_config': resources { 'nova_config':
purge => true purge => true
} }
nova_config { ['verbose', 'nodaemomize']: nova_config { ['DEFAULT/verbose', 'DEFAULT/nodaemomize']:
value => 'true', value => 'true',
} }
nova_config { 'xenapi_connection_username': nova_config { 'DEFAULT/xenapi_connection_username':
value => 'rootty', value => 'rootty',
} }

View File

@@ -3,7 +3,6 @@ This test should configure everything needed to run openstack on a compute vm ru
on a xenserver. on a xenserver.
*/ */
Nova_config { target => '/etc/nova/nova.conf' }
resources { 'nova_config': resources { 'nova_config':
purge => true, purge => true,
} }

View File

@@ -1,5 +1,5 @@
class { 'nova': } class { 'nova': }
class { 'nova::volume': class { 'nova::volume':
enabled => true, enabled => true,
} }