Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Commit

Permalink
Fix for issue #8 with package requiring repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastiaan Schaap committed Aug 27, 2014
1 parent 530e23c commit b9f877b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
12 changes: 10 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@
case $::osfamily {
'Debian': {
class { 'uchiwa::repo::apt': }
$repo_require = Apt::Source['sensu']
if str2bool($uchiwa::install_repo) {
$repo_require = Apt::Source['sensu']
} else {
$repo_require = undef
}
}

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

default: { alert("${::osfamily} not supported yet") }
Expand Down
24 changes: 17 additions & 7 deletions spec/classes/uchiwa_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'spec_helper'

describe 'uchiwa' do
let(:facts) {
{
let(:facts) {
{
:osfamily => 'RedHat',
:concat_basedir => '/dne',
}
}

it 'should compile' do should create_class('uchiwa') end
it { should contain_class('uchiwa::config')}

Expand All @@ -32,12 +32,12 @@
context 'repos' do

context 'ubuntu' do
let(:facts) {
{
let(:facts) {
{
:osfamily => 'Debian',
:fqdn => 'testhost.domain.com',
:concat_basedir => '/dne'
}
:concat_basedir => '/dne'
}
}

context 'with puppet-apt installed' do
Expand Down Expand Up @@ -82,12 +82,17 @@

context 'install_repo => false' do
let(:params) { { :install_repo => false, :repo => 'main' } }

it { should_not contain_apt__source('sensu') }

it { should_not contain_apt__key('sensu').with(
:key => '7580C77F',
:key_source => 'http://repos.sensuapp.org/apt/pubkey.gpg'
) }

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

Expand Down Expand Up @@ -120,7 +125,12 @@

context 'install_repo => false' do
let(:params) { { :install_repo => false } }

it { should_not contain_yumrepo('sensu') }

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

0 comments on commit b9f877b

Please sign in to comment.