Allow to change CentOS mirror URL

With a new parameter, centos_mirror_url, allow to change the CentOS
mirror URL.

Change-Id: Ibde2a03bd650610410cc7d8c02f8ca66a3e50de9
This commit is contained in:
Emilien Macchi 2016-05-13 21:58:42 +02:00
parent bd7df63b8f
commit 0fcefb98e6
3 changed files with 12 additions and 3 deletions

View File

@ -54,6 +54,10 @@
# 'priority' value in yumrepo will be effective.
# Defaults to true
#
# [*centos_mirror_url*]
# (optional) URL of CentOS mirror.
# Defaults to 'http://mirror.centos.org'
#
class openstack_extras::repo::redhat::redhat(
$release = $::openstack_extras::repo::redhat::params::release,
$manage_rdo = true,
@ -65,6 +69,7 @@ class openstack_extras::repo::redhat::redhat(
$purge_unmanaged = false,
$package_require = false,
$manage_priorities = true,
$centos_mirror_url = 'http://mirror.centos.org',
) inherits openstack_extras::repo::redhat::params {
validate_string($release)
@ -93,7 +98,7 @@ class openstack_extras::repo::redhat::redhat(
$rdo_hash = {
'rdo-release' => {
'baseurl' => "http://mirror.centos.org/centos/7/cloud/\$basearch/openstack-${release}/",
'baseurl' => "${centos_mirror_url}/centos/7/cloud/\$basearch/openstack-${release}/",
'descr' => "OpenStack ${release_cap} Repository",
'priority' => $::openstack_extras::repo::redhat::params::rdo_priority,
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud',

View File

@ -0,0 +1,3 @@
---
features:
- Allow to change CentOS mirror URL with a new parameter, centos_mirror_url.

View File

@ -163,12 +163,13 @@ describe 'openstack_extras::repo::redhat::redhat' do
let :params do
default_params.merge!({ :repo_defaults => {
'proxy' => 'http://my.proxy.com:8000'
}
},
:centos_mirror_url => 'http://mirror.dfw.rax.openstack.org',
})
end
it { is_expected.to contain_yumrepo('rdo-release').with(
:baseurl => "http://mirror.centos.org/centos/7/cloud/\$basearch/openstack-mitaka/",
:baseurl => "http://mirror.dfw.rax.openstack.org/centos/7/cloud/\$basearch/openstack-mitaka/",
:descr => "OpenStack Mitaka Repository",
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud",
:proxy => "http://my.proxy.com:8000"