diff --git a/manifests/init.pp b/manifests/init.pp index 48fab26..2d672ca 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -57,6 +57,9 @@ # [*purge_collectors*] # Determine if we should purge collectors Puppet does not manage # +# [*purge_handlers*] +# Determine if we should purge handlers Puppet does not manage +# # [*install_from_pip*] # Determine if we should install diamond from python-pip # @@ -89,6 +92,7 @@ $hostname_method = undef, $handlers_path = undef, $purge_collectors = false, + $purge_handlers = false, $install_from_pip = false, ) { class{'diamond::install': } -> diff --git a/manifests/install.pp b/manifests/install.pp index ab01386..8a49881 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -91,6 +91,16 @@ require => File['/etc/diamond'], } + file { '/etc/diamond/handlers': + ensure => directory, + owner => root, + group => root, + mode => '0755', + purge => $diamond::purge_handlers, + recurse => true, + require => File['/etc/diamond'], + } + if $diamond::librato_user and $diamond::librato_apikey { ensure_packages(['python-pip']) ensure_resource('package', 'librato-metrics', {'ensure' => 'present', 'provider' => pip, 'before' => Package['python-pip']}) diff --git a/metadata.json b/metadata.json index 1f43889..aedeaf3 100644 --- a/metadata.json +++ b/metadata.json @@ -31,7 +31,10 @@ "operatingsystemrelease": [ "5.11" ] + },{ + "operatingsystem": "Archlinux" } + ], "requirements": [ { diff --git a/spec/classes/diamond/diamond_spec.rb b/spec/classes/diamond/diamond_spec.rb index 0369e03..5a10484 100644 --- a/spec/classes/diamond/diamond_spec.rb +++ b/spec/classes/diamond/diamond_spec.rb @@ -11,6 +11,7 @@ it { should contain_file('/etc/diamond/diamond.conf').with_content(/interval = 30/)} it { should contain_file('/etc/diamond/collectors').with('purge' => 'false')} + it { should contain_file('/etc/diamond/handlers').with('purge' => 'false')} it { should_not contain_package('python-pip')} it { should_not contain_package('librato-metrics')} @@ -140,6 +141,16 @@ it { should contain_file('/etc/diamond/collectors').with('purge' => 'false')} end + context 'with purging handlers' do + let (:params) { {'purge_handlers' => true} } + it { should contain_file('/etc/diamond/handlers').with('purge' => 'true')} + end + + context 'with not purging handlers' do + let (:params) { {'purge_handlers' => false} } + it { should contain_file('/etc/diamond/handlers').with('purge' => 'false')} + end + context 'with enabling pip installation on RedHat' do let (:params) { {'install_from_pip' => true} } let (:facts) { {:osfamily => 'RedHat'} }