Skip to content

Commit 503bee0

Browse files
committed
fix ubuntu 18.04 invalid repo
Postgresql no longer specifically supports Ubuntu 18.04, but still supports Debian 10 which can be used until Puppet drops support for Ubuntu 18.04.
1 parent 26011ea commit 503bee0

File tree

5 files changed

+34
-2
lines changed

5 files changed

+34
-2
lines changed

data/os/Ubuntu/18.04.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
postgresql::repo::baseurl: https://apt-archive.postgresql.org/pub/repos/apt/
3+
postgresql::repo::release: "%{facts.os.distro.codename}-pgdg-archive"

manifests/globals.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#
6161
# @param repo_baseurl Sets the baseurl for the PostgreSQL repository. Useful if you host your own mirror of the repository.
6262
# @param yum_repo_commonurl Sets the url for the PostgreSQL common Yum repository. Useful if you host your own mirror of the YUM repository.
63+
# @param apt_source_release Overrides the default release for the apt source.
6364
#
6465
# @param needs_initdb
6566
# Explicitly calls the initdb operation after the server package is installed and before the PostgreSQL service is started.
@@ -150,6 +151,7 @@
150151
Optional[String[1]] $repo_proxy = undef,
151152
Optional[String[1]] $repo_baseurl = undef,
152153
Optional[String[1]] $yum_repo_commonurl = undef,
154+
Optional[String[1]] $apt_source_release = undef,
153155

154156
Optional[Boolean] $needs_initdb = undef,
155157

@@ -271,6 +273,7 @@
271273
proxy => $repo_proxy,
272274
baseurl => $repo_baseurl,
273275
commonurl => $yum_repo_commonurl,
276+
release => $apt_source_release,
274277
}
275278
}
276279

manifests/repo.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# @api private
22
class postgresql::repo (
3+
Optional[String[1]] $release = undef,
34
Optional[String[1]] $version = undef,
45
Optional[String[1]] $proxy = undef,
56
Optional[String[1]] $baseurl = undef,

manifests/repo/apt_postgresql_org.pp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
# http://www.postgresql.org/download/linux/debian/
88
#
99
$default_baseurl = 'https://apt.postgresql.org/pub/repos/apt/'
10-
1110
$_baseurl = pick($postgresql::repo::baseurl, $default_baseurl)
1211

12+
$default_release = "${facts['os']['distro']['codename']}-pgdg"
13+
$_release = pick($postgresql::repo::release, $default_release)
14+
1315
apt::pin { 'apt_postgresql_org':
1416
originator => 'apt.postgresql.org',
1517
priority => 500,
1618
}
1719
-> apt::source { 'apt.postgresql.org':
1820
location => $_baseurl,
19-
release => "${facts['os']['distro']['codename']}-pgdg",
21+
release => $_release,
2022
repos => 'main',
2123
architecture => $facts['os']['architecture'],
2224
key => {

spec/classes/repo_spec.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,28 @@
99
it 'instantiates apt_postgresql_org class' do
1010
expect(subject).to contain_class('postgresql::repo::apt_postgresql_org')
1111
end
12+
13+
it {
14+
is_expected.to contain_apt__source('apt.postgresql.org')
15+
.with_location('https://apt.postgresql.org/pub/repos/apt/')
16+
.with_release("#{facts[:os]['distro']['codename']}-pgdg")
17+
}
18+
19+
it { is_expected.to contain_apt__pin('apt_postgresql_org') }
20+
end
21+
22+
describe 'with custom baseurl and release' do
23+
let(:params) do
24+
{
25+
baseurl: 'https://apt-archive.postgresql.org/pub/repos/apt/',
26+
release: 'bionic-pgdg-archive',
27+
}
28+
end
29+
30+
it {
31+
is_expected.to contain_apt__source('apt.postgresql.org')
32+
.with_location(params[:baseurl])
33+
.with_release(params[:release])
34+
}
1235
end
1336
end

0 commit comments

Comments
 (0)