From 015be53c81fa59f1ec85d743afbdceea1ad00e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Charlier?= Date: Mon, 25 Feb 2013 19:51:59 +0100 Subject: [PATCH] Add the ceilometer middleware Change-Id: Ibcdaa1218c8d027dc3e4b6d2cd394e9d0af8c6da --- manifests/proxy/ceilometer.pp | 35 +++++++++++++++++++++ spec/classes/swift_proxy_ceilometer_spec.rb | 30 ++++++++++++++++++ templates/proxy/ceilometer.conf.erb | 3 ++ 3 files changed, 68 insertions(+) create mode 100644 manifests/proxy/ceilometer.pp create mode 100644 spec/classes/swift_proxy_ceilometer_spec.rb create mode 100644 templates/proxy/ceilometer.conf.erb diff --git a/manifests/proxy/ceilometer.pp b/manifests/proxy/ceilometer.pp new file mode 100644 index 00000000..4ff5aa74 --- /dev/null +++ b/manifests/proxy/ceilometer.pp @@ -0,0 +1,35 @@ +# +# Configure ceilometer middleware for swift +# +# == Dependencies +# +# puppet-ceilometer (http://github.com/enovance/puppet-ceilometer) +# +# == Examples +# +# == Authors +# +# Francois Charlier fcharlier@enovance.com +# +# == Copyright +# +# Copyright 2013 eNovance licensing@enovance.com +# +class swift::proxy::ceilometer( + $ensure = 'present' +) inherits swift { + + include $::swift::params + + User['swift'] { + groups +> 'ceilometer', + } + + concat::fragment { 'swift_ceilometer': + target => '/etc/swift/proxy-server.conf', + content => template('swift/proxy/ceilometer.conf.erb'), + order => '33', + require => Class['::ceilometer'] + } + +} diff --git a/spec/classes/swift_proxy_ceilometer_spec.rb b/spec/classes/swift_proxy_ceilometer_spec.rb new file mode 100644 index 00000000..2727199f --- /dev/null +++ b/spec/classes/swift_proxy_ceilometer_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe 'swift::proxy::ceilometer' do + + let :facts do + { + :concat_basedir => '/var/lib/puppet/concat', + :osfamily => 'Debian' + } + end + + let :pre_condition do + 'class { "concat::setup": } + concat { "/etc/swift/proxy-server.conf": } + class { "ssh::server::install": } + class { "swift": + swift_hash_suffix => "dummy" + }' + end + + let :fragment_file do + "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/33_swift_ceilometer" + end + + it { should contain_file(fragment_file).with_content(/[filter:ceilometer]/) } + it { should contain_file(fragment_file).with_content(/use = egg:ceilometer#swift/) } + it { should contain_concat__fragment('swift_ceilometer').with_require('Class[::Ceilometer]') } + it { should contain_user('swift').with_groups('ceilometer') } + +end diff --git a/templates/proxy/ceilometer.conf.erb b/templates/proxy/ceilometer.conf.erb new file mode 100644 index 00000000..1bc6bc88 --- /dev/null +++ b/templates/proxy/ceilometer.conf.erb @@ -0,0 +1,3 @@ +[filter:ceilometer] +use = egg:ceilometer#swift +