Introduce nova::config

Add a new class nova::config which allows the creation and
management of arbitrary nova_config and nova_api_paste_ini resources.

This will add the ability for the end user to use Hiera to manage
those resources.

Change-Id: Iad7a2b764884887a75f5f6db3e1660644e07c5c0
Closes-bug: #1290634
This commit is contained in:
Mathieu Gagné
2014-03-10 21:46:17 -04:00
parent 5f8a944a46
commit 4018835632
2 changed files with 55 additions and 0 deletions

25
manifests/config.pp Normal file
View File

@@ -0,0 +1,25 @@
# == Class: nova::config
#
# This class is used to manage arbitrary Nova configurations.
#
# === Parameters
#
# [*nova_config*]
# (optional) Allow configuration of arbitrary Nova configurations.
# The value is an hash of nova_config resources. Example:
# { 'DEFAULT/foo': value => 'fooValue'; 'DEFAULT/bar': value => 'barValue'}
#
# NOTE: The configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
class nova::config (
$nova_config = {},
$nova_paste_api_ini = {},
) {
validate_hash($nova_config)
validate_hash($nova_paste_api_ini)
create_resources('nova_config', $nova_config)
create_resources('nova_paste_api_ini', $nova_paste_api_ini)
}

View File

@@ -0,0 +1,30 @@
require 'spec_helper'
describe 'nova::config' do
let :params do
{ :nova_config => {
'DEFAULT/foo' => { 'value' => 'fooValue' },
'DEFAULT/bar' => { 'value' => 'barValue' },
'DEFAULT/baz' => { 'ensure' => 'absent' }
},
:nova_paste_api_ini => {
'DEFAULT/foo2' => { 'value' => 'fooValue' },
'DEFAULT/bar2' => { 'value' => 'barValue' },
'DEFAULT/baz2' => { 'ensure' => 'absent' }
}
}
end
it 'configures arbitrary nova configurations' do
should contain_nova_config('DEFAULT/foo').with_value('fooValue')
should contain_nova_config('DEFAULT/bar').with_value('barValue')
should contain_nova_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary nova api-paste configurations' do
should contain_nova_paste_api_ini('DEFAULT/foo2').with_value('fooValue')
should contain_nova_paste_api_ini('DEFAULT/bar2').with_value('barValue')
should contain_nova_paste_api_ini('DEFAULT/baz2').with_ensure('absent')
end
end