diff --git a/manifests/init.pp b/manifests/init.pp index 66c3eb20..c4a84140 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -74,6 +74,9 @@ # Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be # available on some distributions. # Defaults to 'TLSv1' +# [*memcached_servers*] +# (optional) A list of memcached server(s) to use for caching. +# Defaults to undef # # [*qpid_hostname*] # [*qpid_port*] @@ -113,6 +116,7 @@ class ceilometer( $kombu_ssl_certfile = undef, $kombu_ssl_keyfile = undef, $kombu_ssl_version = 'TLSv1', + $memcached_servers = undef, $qpid_hostname = 'localhost', $qpid_port = 5672, $qpid_username = 'guest', @@ -304,4 +308,17 @@ class ceilometer( } } + if $memcached_servers { + validate_array($memcached_servers) + } + + if $memcached_servers { + ceilometer_config { + 'DEFAULT/memcached_servers': value => join($memcached_servers, ',') + } + } else { + ceilometer_config { + 'DEFAULT/memcached_servers': ensure => absent; + } + } } diff --git a/spec/classes/ceilometer_init_spec.rb b/spec/classes/ceilometer_init_spec.rb index 9b151293..c582fa13 100644 --- a/spec/classes/ceilometer_init_spec.rb +++ b/spec/classes/ceilometer_init_spec.rb @@ -331,6 +331,16 @@ describe 'ceilometer' do end end + shared_examples_for 'memcached support' do + context "with memcached enabled" do + before { params.merge!( + :memcached_servers => ['1.2.3.4','1.2.3.5'] + ) } + + it { is_expected.to contain_ceilometer_config('DEFAULT/memcached_servers').with_value('1.2.3.4,1.2.3.5') } + end + end + context 'on Debian platforms' do let :facts do { :osfamily => 'Debian' }