Merge "Add gnocchi::config class"

This commit is contained in:
Jenkins 2015-07-20 18:59:23 +00:00 committed by Gerrit Code Review
commit dc2a8521b4
2 changed files with 50 additions and 0 deletions

30
manifests/config.pp Normal file
View File

@ -0,0 +1,30 @@
# == Class: gnocchi::config
#
# This class is used to manage arbitrary Gnocchi configurations.
#
# === Parameters
#
# [*gnocchi_config*]
# (optional) Allow configuration of arbitrary Gnocchi configurations.
# The value is an hash of gnocchi_config resources. Example:
# { 'DEFAULT/foo' => { value => 'fooValue'},
# 'DEFAULT/bar' => { value => 'barValue'}
# }
# In yaml format, Example:
# gnocchi_config:
# 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 gnocchi::config (
$gnocchi_config = {},
) {
validate_hash($gnocchi_config)
create_resources('gnocchi_config', $gnocchi_config)
}

View File

@ -0,0 +1,20 @@
require 'spec_helper'
describe 'gnocchi::config' do
let :params do
{ :gnocchi_config => {
'DEFAULT/foo' => { 'value' => 'fooValue' },
'DEFAULT/bar' => { 'value' => 'barValue' },
'DEFAULT/baz' => { 'ensure' => 'absent' }
}
}
end
it 'configures arbitrary gnocchi configurations' do
is_expected.to contain_gnocchi_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_gnocchi_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_gnocchi_config('DEFAULT/baz').with_ensure('absent')
end
end