Skip to content

Commit

Permalink
Fix for when ci_package_repo is set to master
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjfisher committed Nov 11, 2018
1 parent 9624672 commit 9e58bdb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
if $collectd::manage_repo {
$osfamily_downcase = downcase($facts['os']['family'])

$real_ci_package_repo = $collectd::ci_package_repo ? {
'master' => $collectd::ci_package_repo,
default => "collectd-${collectd::ci_package_repo}",
}

if defined("::collectd::repo::${osfamily_downcase}") {
require "::collectd::repo::${osfamily_downcase}"
} else {
Expand Down
2 changes: 1 addition & 1 deletion manifests/repo/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

apt::source { 'collectd-ci':
location => 'https://pkg.ci.collectd.org/deb/',
repos => "collectd-${$::collectd::ci_package_repo}",
repos => $collectd::repo::real_ci_package_repo,
key => {
'id' => 'F806817DC3F5EA417F9FA2963994D24FB8543576',
'server' => $::collectd::package_keyserver,
Expand Down
2 changes: 1 addition & 1 deletion manifests/repo/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
yumrepo { 'collectd-ci':
ensure => present,
enabled => '1',
baseurl => "https://pkg.ci.collectd.org/rpm/collectd-${::collectd::ci_package_repo}/epel-${::operatingsystemmajrelease}-${::architecture}",
baseurl => "https://pkg.ci.collectd.org/rpm/${collectd::repo::real_ci_package_repo}/epel-${::operatingsystemmajrelease}-${::architecture}",
gpgkey => 'https://pkg.ci.collectd.org/pubkey.asc',
}

Expand Down
10 changes: 10 additions & 0 deletions spec/classes/collectd_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@
end
end
end
context 'and ci_package_repo set to `master`' do
let(:params) { { manage_repo: true, ci_package_repo: 'master' } }

if facts[:osfamily] == 'RedHat'
it { is_expected.to contain_yumrepo('collectd-ci').with_baseurl("https://pkg.ci.collectd.org/rpm/master/epel-#{facts[:operatingsystemmajrelease]}-x86_64") }
end
if facts[:osfamily] == 'Debian'
it { is_expected.to contain_apt__source('collectd-ci').with_repos('master') }
end
end
end

context 'when manage_service is true' do
Expand Down

0 comments on commit 9e58bdb

Please sign in to comment.