Introduce murano:config to manage custom options

This murano::config is aim to use murano config resources
to manage custom configurations in murano config files.

This will make end user easy to add their own custom options
in Hiera data.

Change-Id: I256b52ad242d99114cf41637b4ff14170d7f4595
This commit is contained in:
Sebastien Badia 2015-10-28 14:45:55 +09:00
parent e608380054
commit b46a7b34c0
2 changed files with 50 additions and 0 deletions

30
manifests/config.pp Normal file
View File

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

View File

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