From 33aec0b38a1cbc02eb9da01a962ec630d0076765 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Fri, 20 Dec 2013 18:29:03 -0800 Subject: [PATCH] add debian support --- README.md | 1 + manifests/params.pp | 41 ++++++++----------- spec/classes/params_spec.rb | 23 ++++------- ....conf.ubuntu.erb => gmond.conf.debian.erb} | 0 4 files changed, 26 insertions(+), 39 deletions(-) rename templates/{gmond.conf.ubuntu.erb => gmond.conf.debian.erb} (100%) diff --git a/README.md b/README.md index 14b915d..d2be56e 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ It has been tested on: * el6.x * ubuntu 12.04 * ubuntu 13.04 +* debian 6.07 `$::osfamily == RedHat` and EPEL packages ----------------------------------------- diff --git a/manifests/params.pp b/manifests/params.pp index 41b95e7..3a9ec94 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -55,38 +55,29 @@ } } debian: { - case $::operatingsystem { - ubuntu: { - # I use ubuntu 12.04 and 13.04, have not tested others - $gmond_package_name = 'ganglia-monitor' - $gmond_service_name = 'ganglia-monitor' + $gmond_package_name = 'ganglia-monitor' + $gmond_service_name = 'ganglia-monitor' - $gmetad_package_name = 'gmetad' - $gmetad_service_name = 'gmetad' - $gmetad_user = 'nobody' + $gmetad_package_name = 'gmetad' + $gmetad_service_name = 'gmetad' + $gmetad_user = 'nobody' - $web_package_name = 'ganglia-webfrontend' - $web_php_config = '/usr/share/ganglia-webfrontend/conf.php' + $web_package_name = 'ganglia-webfrontend' + $web_php_config = '/usr/share/ganglia-webfrontend/conf.php' - $gmond_service_config = '/etc/ganglia/gmond.conf' - $gmond_service_erb = 'ganglia/gmond.conf.ubuntu.erb' + $gmond_service_config = '/etc/ganglia/gmond.conf' + $gmond_service_erb = 'ganglia/gmond.conf.debian.erb' - $gmetad_service_config = '/etc/ganglia/gmetad.conf' - # it's the same file as el6 with only the default user comment changed - $gmetad_service_erb = 'ganglia/gmetad.conf.el6.erb' + $gmetad_service_config = '/etc/ganglia/gmetad.conf' + # it's the same file as el6 with only the default user comment changed + $gmetad_service_erb = 'ganglia/gmetad.conf.el6.erb' - # ubuntu 12.10 and below didn't have a status command in the init script - if ($::lsbmajdistrelease <= 12) { - $gmond_status_command = 'pgrep -u ganglia -f /usr/sbin/gmond' - $gmetad_status_command = 'pgrep -u nobody -f /usr/sbin/gmetad' - } - } - default: { - fail("Module ${module_name} is not supported on osfamily/operatingsystem: ${::osfamily}/${::operatingsystem}") - } + # ubuntu 12.10 and below didn't have a status command in the init script + if ! ($::operatingsystem == 'Ubuntu' and $::lsbmajdistrelease > 12) { + $gmond_status_command = 'pgrep -u ganglia -f /usr/sbin/gmond' + $gmetad_status_command = 'pgrep -u nobody -f /usr/sbin/gmetad' } } - default: { fail("Module ${module_name} is not supported on ${::operatingsystem}") } diff --git a/spec/classes/params_spec.rb b/spec/classes/params_spec.rb index fd30f25..96fa3f4 100644 --- a/spec/classes/params_spec.rb +++ b/spec/classes/params_spec.rb @@ -34,29 +34,24 @@ end describe 'for osfamily debian' do - let :facts do - { - :osfamily => 'Debian' - } - end + let(:facts) {{ :osfamily => 'Debian' }} - describe 'for operatingsystem ubuntu' do - before { facts[:operatingsystem] = 'Ubuntu' ; facts[:lsbmajdistrelease] = 12 } + describe 'for operatingsystem debian' do + before { facts[:operatingsystem] = 'Debian' } it { should contain_class('ganglia::params') } end - describe 'for operatingsystem debian' do - before { facts[:operatingsystem] = 'Debian' } - - it 'should fail' do - expect { should contain_class('ganglia::params') }. - to raise_error(Puppet::Error, /not supported on .*Debian\/Debian/) + describe 'for operatingsystem ubuntu' do + before do + facts[:operatingsystem] = 'Ubuntu' + facts[:lsbmajdistrelease] = 12 end + + it { should contain_class('ganglia::params') } end end - describe 'unsupported osfamily' do let :facts do { diff --git a/templates/gmond.conf.ubuntu.erb b/templates/gmond.conf.debian.erb similarity index 100% rename from templates/gmond.conf.ubuntu.erb rename to templates/gmond.conf.debian.erb