diff --git a/manifests/config.pp b/manifests/config.pp new file mode 100644 index 00000000..934a4c32 --- /dev/null +++ b/manifests/config.pp @@ -0,0 +1,39 @@ +# == Class: designate::config +# +# This class is used to manage arbitrary designate configurations. +# +# === Parameters +# +# [*xxx_config*] +# (optional) Allow configuration of arbitrary designate configurations. +# The value is an hash of xxx_config resources. Example: +# { 'DEFAULT/foo' => { value => 'fooValue'}, +# 'DEFAULT/bar' => { value => 'barValue'} +# } +# +# In yaml format, Example: +# xxx_config: +# DEFAULT/foo: +# value: fooValue +# DEFAULT/bar: +# value: barValue +# +# [**designate_config**] +# (optional) Allow configuration of designate.conf configurations. +# +# [**api_paste_ini_config**] +# (optional) Allow configuration of /etc/designate/api-paste.ini configurations. +# +# NOTE: The configuration MUST NOT be already handled by this module +# or Puppet catalog compilation will fail with duplicate resources. +# +class designate::config ( + $designate_config = {}, + $api_paste_ini_config = {}, +) { + validate_hash($designate_config) + validate_hash($api_paste_ini_config) + + create_resources('designate_config', $designate_config) + create_resources('designate_api_paste_ini', $api_paste_ini_config) +} diff --git a/spec/classes/designate_config_spec.rb b/spec/classes/designate_config_spec.rb new file mode 100644 index 00000000..274468c8 --- /dev/null +++ b/spec/classes/designate_config_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe 'designate::config' do + + let :params do + { :designate_config => { + 'DEFAULT/foo' => { 'value' => 'fooValue' }, + 'DEFAULT/bar' => { 'value' => 'barValue' }, + 'DEFAULT/baz' => { 'ensure' => 'absent' } + }, + :api_paste_ini_config => { + 'DEFAULT/foo2' => { 'value' => 'fooValue' }, + 'DEFAULT/bar2' => { 'value' => 'barValue' }, + 'DEFAULT/baz2' => { 'ensure' => 'absent' } + } + } + end + + it 'configures arbitrary designate configurations' do + should contain_designate_config('DEFAULT/foo').with_value('fooValue') + should contain_designate_config('DEFAULT/bar').with_value('barValue') + should contain_designate_config('DEFAULT/baz').with_ensure('absent') + end + + it 'configures arbitrary designate api-paste configurations' do + should contain_designate_api_paste_ini('DEFAULT/foo2').with_value('fooValue') + should contain_designate_api_paste_ini('DEFAULT/bar2').with_value('barValue') + should contain_designate_api_paste_ini('DEFAULT/baz2').with_ensure('absent') + end +end