repos: allow to configure Debian mirror

Allow to choose from which server to dowload Debian packages for Ceph.

Change-Id: If84d1d0b5ae3bcf4042e62b0328600891e43887e
(cherry picked from commit ff24009ee0)
This commit is contained in:
Emilien Macchi 2016-07-19 16:38:26 -04:00
parent 3ceb4fd8ba
commit 9d06c5f559
2 changed files with 25 additions and 1 deletions

View File

@ -56,6 +56,9 @@
# https://wiki.centos.org/SpecialInterestGroup/Storage/
# Optional. Defaults to False in ceph::params.
#
# [*ceph_mirror*] Ceph mirror used to download packages.
# Optional. Defaults to undef.
#
class ceph::repo (
$ensure = present,
$release = $::ceph::params::release,
@ -65,6 +68,7 @@ class ceph::repo (
$proxy_password = undef,
$enable_epel = true,
$enable_sig = $::ceph::params::enable_sig,
$ceph_mirror = undef,
) inherits ceph::params {
case $::osfamily {
'Debian': {
@ -76,9 +80,15 @@ class ceph::repo (
source => 'https://download.ceph.com/keys/release.asc',
}
if $ceph_mirror {
$ceph_mirror_real = $ceph_mirror
} else {
$ceph_mirror_real = "http://download.ceph.com/debian-${release}/"
}
apt::source { 'ceph':
ensure => $ensure,
location => "http://download.ceph.com/debian-${release}/",
location => $ceph_mirror_real,
release => $::lsbdistcodename,
require => Apt::Key['ceph'],
tag => 'ceph',

View File

@ -46,6 +46,20 @@ describe 'ceph::repo' do
end
describe "when overriding ceph mirror" do
let :params do
{
:ceph_mirror => 'http://myserver.com/debian-hammer/'
}
end
it { is_expected.to contain_apt__source('ceph').with(
:location => 'http://myserver.com/debian-hammer/',
:release => 'jessie',
:require => 'Apt::Key[ceph]'
) }
end
describe "when overriding ceph release" do
let :params do
{