diff --git a/manifests/repo/redhat/redhat.pp b/manifests/repo/redhat/redhat.pp index 80cd694..baf2f9f 100644 --- a/manifests/repo/redhat/redhat.pp +++ b/manifests/repo/redhat/redhat.pp @@ -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', diff --git a/releasenotes/notes/add_centos_mirror-079eb2b38940f583.yaml b/releasenotes/notes/add_centos_mirror-079eb2b38940f583.yaml new file mode 100644 index 0000000..8f8bd30 --- /dev/null +++ b/releasenotes/notes/add_centos_mirror-079eb2b38940f583.yaml @@ -0,0 +1,3 @@ +--- +features: + - Allow to change CentOS mirror URL with a new parameter, centos_mirror_url. diff --git a/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb b/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb index 17b04ad..2f4ebd1 100644 --- a/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb +++ b/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb @@ -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"