Skip to content

Commit

Permalink
Merge pull request #2 from jhoblitt/debian_support
Browse files Browse the repository at this point in the history
add $::osfamily == debian support
  • Loading branch information
Joshua Hoblitt committed Dec 28, 2013
2 parents cc3704c + 1b245fc commit 84ad3b4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
language: ruby
before_install:
- gem update --system 2.1.11
- gem --version
rvm:
- 1.8.7
- 1.9.3
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ releases prior to el6.x.
### Tested on

* el6.x
* Debian 7.0 (wheezy)


Versioning
Expand Down
6 changes: 5 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@
#
class policykit::params {

$policykit_local_path = '/etc/polkit-1/localauthority/50-local.d'

case $::osfamily {
'redhat': {
case $::operatingsystemmajrelease {
6: {
$policykit_package = 'polkit'
$policykit_local_path = '/etc/polkit-1/localauthority/50-local.d'
}
default: {
fail("Module ${module_name} is not supported on operatingsystemmajrelease ${::operatingsystemmajrelease}")
}
}
}
'debian': {
$policykit_package = 'policykit-1'
}
default: {
fail("Module ${module_name} is not supported on ${::operatingsystem}")
}
Expand Down
12 changes: 9 additions & 3 deletions spec/classes/policykit_params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@
end
end

describe 'for osfamily Debian' do
let(:facts) {{ :osfamily => 'Debian' }}

it { should contain_class('policykit::params') }
end

describe 'unsupported osfamily' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:osfamily => 'Solaris',
:operatingsystem => 'Solaris',
}
end

it 'should fail' do
expect { should contain_class('policykit::params') }.
to raise_error(Puppet::Error, /not supported on Debian/)
to raise_error(Puppet::Error, /not supported on Solaris/)
end
end

Expand Down
4 changes: 3 additions & 1 deletion spec/system/policykit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

describe 'policykit class' do
case node.facts['osfamily']
when 'RedHat', 'Debian'
when 'RedHat'
package_name = 'polkit'
when 'Debian'
package_name = 'policykit-1'
end

describe 'running puppet code' do
Expand Down

0 comments on commit 84ad3b4

Please sign in to comment.