Skip to content

Commit

Permalink
Merge pull request #1298 from elfranne/repo_source
Browse files Browse the repository at this point in the history
add repo_source for custom Debian repo
  • Loading branch information
bastelfreak authored Feb 8, 2019
2 parents 8c82a74 + 8b67cbc commit 4e806ea
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
Boolean $mime_types_preserve_defaults = false,
Optional[String] $repo_release = undef,
$passenger_package_ensure = 'present',
Optional[Stdlib::HTTPUrl] $repo_source = undef,
### END Package Configuration ###

### START Service Configuation ###
Expand Down
19 changes: 16 additions & 3 deletions manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
$passenger_package_ensure = $nginx::passenger_package_ensure
$manage_repo = $nginx::manage_repo
$release = $nginx::repo_release
$repo_source = $nginx::repo_source

$distro = downcase($facts['os']['name'])

Expand All @@ -36,24 +37,36 @@

case $package_source {
'nginx', 'nginx-stable': {
$stable_repo_source = $repo_source ? {
undef => "https://nginx.org/packages/${distro}",
default => $repo_source,
}
apt::source { 'nginx':
location => "https://nginx.org/packages/${distro}",
location => $stable_repo_source,
repos => 'nginx',
key => {'id' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62'},
release => $release,
}
}
'nginx-mainline': {
$mainline_repo_source = $repo_source ? {
undef => "https://nginx.org/packages/mainline/${distro}",
default => $repo_source,
}
apt::source { 'nginx':
location => "https://nginx.org/packages/mainline/${distro}",
location => $mainline_repo_source,
repos => 'nginx',
key => {'id' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62'},
release => $release,
}
}
'passenger': {
$passenger_repo_source = $repo_source ? {
undef => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
default => $repo_source,
}
apt::source { 'nginx':
location => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
location => $passenger_repo_source,
repos => 'main',
key => {'id' => '16378A33A6EF16762922526E561F9B9CAC40B2F7'},
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.25.0 < 6.0.0"
"version_requirement": ">= 5.0.0 < 6.0.0"
},
{
"name": "puppetlabs/concat",
Expand Down
10 changes: 10 additions & 0 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@
end
end

context 'repo_source' do
let(:params) { { repo_source: 'https://example.com/nginx' } }

it do
is_expected.to contain_apt__source('nginx').with(
'location' => 'https://example.com/nginx'
)
end
end

context 'package_source => nginx-mainline' do
let(:params) { { package_source: 'nginx-mainline' } }

Expand Down

0 comments on commit 4e806ea

Please sign in to comment.