Skip to content

Commit

Permalink
Fix for issue #233: accomodating for install_repo, with specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastiaan Schaap committed Aug 27, 2014
1 parent 64aa8a8 commit 9c9f481
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 10 additions & 2 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@

'Debian': {
class { 'sensu::repo::apt': }
$repo_require = Apt::Source['sensu']
if str2bool($sensu::install_repo) {
$repo_require = Apt::Source['sensu']
} else {
$repo_require = undef
}
}

'RedHat': {
class { 'sensu::repo::yum': }
$repo_require = Yumrepo['sensu']
if str2bool($sensu::install_repo) {
$repo_require = Yumrepo['sensu']
} else {
$repo_require = undef
}
}

default: { alert("${::osfamily} not supported yet") }
Expand Down
3 changes: 3 additions & 0 deletions spec/classes/sensu_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
:key => '7580C77F',
:key_source => 'http://repos.sensuapp.org/apt/pubkey.gpg'
) }

it { should contain_package('sensu').with( :require => nil ) }
end
end

Expand Down Expand Up @@ -121,6 +123,7 @@
context 'install_repo => false' do
let(:params) { { :install_repo => false } }
it { should_not contain_yumrepo('sensu') }
it { should contain_package('sensu').with( :require => nil ) }
end
end
end
Expand Down

0 comments on commit 9c9f481

Please sign in to comment.