mirror of
https://github.com/voxpupuli/puppet-hashi_stack.git
synced 2025-05-24 19:05:01 +01:00
Merge pull request #5 from nbarrientos/baseurl
Allow customising the base URL of the Yum repository
This commit is contained in:
commit
2feb104b49
2 changed files with 21 additions and 2 deletions
|
@ -17,12 +17,14 @@
|
||||||
# @param key_id GPG key to authenticate Apt package signatures.
|
# @param key_id GPG key to authenticate Apt package signatures.
|
||||||
# @param key_source The location of an existing GPG key file to copy.
|
# @param key_source The location of an existing GPG key file to copy.
|
||||||
# @param description Repository description
|
# @param description Repository description
|
||||||
|
# @param rpm_base Base URL for the Yum repository
|
||||||
class hashi_stack::repo (
|
class hashi_stack::repo (
|
||||||
Optional[Integer] $priority = undef,
|
Optional[Integer] $priority = undef,
|
||||||
String $proxy = 'absent',
|
String $proxy = 'absent',
|
||||||
String $key_id = 'E8A032E094D8EB4EA189D270DA418C88A3219F7B',
|
String $key_id = 'E8A032E094D8EB4EA189D270DA418C88A3219F7B',
|
||||||
Stdlib::HTTPSUrl $key_source = 'https://apt.releases.hashicorp.com/gpg',
|
Stdlib::HTTPSUrl $key_source = 'https://apt.releases.hashicorp.com/gpg',
|
||||||
String $description = 'HashiCorp package repository.',
|
String $description = 'HashiCorp package repository.',
|
||||||
|
String $rpm_base = 'https://rpm.releases.hashicorp.com',
|
||||||
) {
|
) {
|
||||||
case $facts['os']['family'] {
|
case $facts['os']['family'] {
|
||||||
'Debian': {
|
'Debian': {
|
||||||
|
@ -48,7 +50,7 @@ class hashi_stack::repo (
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
yumrepo { 'HashiCorp':
|
yumrepo { 'HashiCorp':
|
||||||
descr => $description,
|
descr => $description,
|
||||||
baseurl => 'https://rpm.releases.hashicorp.com/RHEL/$releasever/$basearch/stable',
|
baseurl => "${rpm_base}/RHEL/\$releasever/\$basearch/stable",
|
||||||
gpgcheck => 1,
|
gpgcheck => 1,
|
||||||
gpgkey => $key_source,
|
gpgkey => $key_source,
|
||||||
enabled => 1,
|
enabled => 1,
|
||||||
|
|
|
@ -9,7 +9,24 @@ describe 'hashi_stack::repo' do
|
||||||
when 'Debian'
|
when 'Debian'
|
||||||
it { is_expected.to contain_apt__source('HashiCorp') }
|
it { is_expected.to contain_apt__source('HashiCorp') }
|
||||||
when 'RedHat'
|
when 'RedHat'
|
||||||
it { is_expected.to contain_yumrepo('HashiCorp') }
|
it {
|
||||||
|
is_expected.to contain_yumrepo('HashiCorp').with(
|
||||||
|
baseurl: 'https://rpm.releases.hashicorp.com/RHEL/$releasever/$basearch/stable',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
context "with custom Yum base url" do
|
||||||
|
let(:params) do
|
||||||
|
{
|
||||||
|
rpm_base: 'https://somewhere.else'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it {
|
||||||
|
is_expected.to contain_yumrepo('HashiCorp').with(
|
||||||
|
baseurl: 'https://somewhere.else/RHEL/$releasever/$basearch/stable',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue