Skip to content

Commit

Permalink
fix manage_package_repo #636
Browse files Browse the repository at this point in the history
  • Loading branch information
fe80 committed Jan 14, 2022
1 parent 3ca0348 commit d64d95b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
16 changes: 10 additions & 6 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@
}

# Setup of the repo only makes sense globally, so we are doing it here.
# For Debian family if manage_package_repo is set at undef that not include mongodb::repo
# For other family if manage_package_repo is set at undef that include mongodb::repo
case $facts['os']['family'] {
'RedHat', 'Linux', 'Suse': {
class { 'mongodb::repo':
ensure => present,
version => pick($version, '3.6'),
use_enterprise_repo => $use_enterprise_repo,
repo_location => $repo_location,
proxy => $repo_proxy,
if $manage_package_repo != false {
class { 'mongodb::repo':
ensure => present,
version => pick($version, '3.6'),
use_enterprise_repo => $use_enterprise_repo,
repo_location => $repo_location,
proxy => $repo_proxy,
}
}
}
default: {
Expand Down
23 changes: 23 additions & 0 deletions spec/classes/globals_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'spec_helper'

describe 'mongodb::globals' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }

if facts[:os]['family'] == 'Debian' && facts[:os]['release']['major'] != '10'
it { is_expected.not_to contain_class('mongodb::repo') }
else
it { is_expected.to contain_class('mongodb::repo') }
end

context 'with manage_package_repo at false' do
let(:params) do
{ manage_package_repo: false }
end

it { is_expected.not_to contain_class('mongodb::repo') }
end
end
end
end

0 comments on commit d64d95b

Please sign in to comment.