Skip to content

Commit

Permalink
Merge pull request jhoblitt#10 from jhoblitt/debian_support
Browse files Browse the repository at this point in the history
add debian support
  • Loading branch information
Joshua Hoblitt committed Dec 21, 2013
2 parents 724099c + 33aec0b commit e4ed800
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 39 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------------------------------
Expand Down
41 changes: 16 additions & 25 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
Expand Down
23 changes: 9 additions & 14 deletions spec/classes/params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
File renamed without changes.

0 comments on commit e4ed800

Please sign in to comment.