Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add package_keyserver parameter #746

Merged
merged 1 commit into from Mar 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -77,6 +77,11 @@ On CentOS that will be EPEL:
On Ubuntu that'll be the CollectD PPA:
* https://launchpad.net/~collectd/+archive/ubuntu/collectd-5.5

### Public key keyserver
In case you need to change the server where to download the public key from for
whatever reason (AKA: server is down) you can use the parameter
`$package_keyserver`

### CI Packages

Recently, Collectd CI packages are also avaliable from the CI repo
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Expand Up @@ -15,6 +15,7 @@
$minimum_version = $collectd::params::minimum_version,
$package_ensure = $collectd::params::package_ensure,
$package_install_options = $collectd::params::package_install_options,
String $package_keyserver = $collectd::params::package_keyserver,
$package_name = $collectd::params::package_name,
$package_provider = $collectd::params::package_provider,
$plugin_conf_dir = $collectd::params::plugin_conf_dir,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Expand Up @@ -25,6 +25,7 @@
$package_install_options = undef
$plugin_conf_dir_mode = '0750'
$ci_package_repo = undef
$package_keyserver = 'keyserver.ubuntu.com'

case $facts['kernel'] {
'OpenBSD': { $has_wordexp = false }
Expand Down
4 changes: 2 additions & 2 deletions manifests/repo/debian.pp
Expand Up @@ -9,7 +9,7 @@
repos => "collectd-${$::collectd::ci_package_repo}",
key => {
'id' => 'F806817DC3F5EA417F9FA2963994D24FB8543576',
'server' => 'pgp.mit.edu',
'server' => $::collectd::package_keyserver,
},
}
} else {
Expand All @@ -22,7 +22,7 @@
repos => 'main',
key => {
'id' => '7543C08D555DC473B9270ACDAF7ECBB3476ACEB3',
'server' => 'keyserver.ubuntu.com',
'server' => $::collectd::package_keyserver,
},
}
}
Expand Down
60 changes: 43 additions & 17 deletions spec/classes/collectd_init_spec.rb
Expand Up @@ -199,25 +199,51 @@
end

context 'and ci_package_repo set to a version' do
let(:params) do
{
manage_repo: true,
ci_package_repo: '5.6'
}
end
context 'and package_keyserver is default' do
let(:params) do
{
manage_repo: true,
ci_package_repo: '5.6'
}
end

if facts[:osfamily] == 'RedHat'
it { is_expected.to contain_yumrepo('collectd-ci').with_gpgkey('https://pkg.ci.collectd.org/pubkey.asc').with_baseurl("https://pkg.ci.collectd.org/rpm/collectd-5.6/epel-#{facts[:operatingsystemmajrelease]}-x86_64") }
if facts[:osfamily] == 'RedHat'
it { is_expected.to contain_yumrepo('collectd-ci').with_gpgkey('https://pkg.ci.collectd.org/pubkey.asc').with_baseurl("https://pkg.ci.collectd.org/rpm/collectd-5.6/epel-#{facts[:operatingsystemmajrelease]}-x86_64") }
end
if facts[:osfamily] == 'Debian'
it do
is_expected.to contain_apt__source('collectd-ci').
with_location('https://pkg.ci.collectd.org/deb/').
with_key(
'id' => 'F806817DC3F5EA417F9FA2963994D24FB8543576',
'server' => 'keyserver.ubuntu.com'
).
with_repos('collectd-5.6')
end
end
end
if facts[:osfamily] == 'Debian'
it do
is_expected.to contain_apt__source('collectd-ci').
with_location('https://pkg.ci.collectd.org/deb/').
with_key(
'id' => 'F806817DC3F5EA417F9FA2963994D24FB8543576',
'server' => 'pgp.mit.edu'
).
with_repos('collectd-5.6')
context 'and package_keyserver is set' do
let(:params) do
{
manage_repo: true,
ci_package_repo: '5.6',
package_keyserver: 'pgp.mit.edu'
}
end

if facts[:osfamily] == 'RedHat'
it { is_expected.to contain_yumrepo('collectd-ci').with_gpgkey('https://pkg.ci.collectd.org/pubkey.asc').with_baseurl("https://pkg.ci.collectd.org/rpm/collectd-5.6/epel-#{facts[:operatingsystemmajrelease]}-x86_64") }
end
if facts[:osfamily] == 'Debian'
it do
is_expected.to contain_apt__source('collectd-ci').
with_location('https://pkg.ci.collectd.org/deb/').
with_key(
'id' => 'F806817DC3F5EA417F9FA2963994D24FB8543576',
'server' => 'pgp.mit.edu'
).
with_repos('collectd-5.6')
end
end
end
end
Expand Down