Skip to content

Commit bcb9dbb

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 bcb9dbb

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

manifests/repo/apt_postgresql_org.pp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@
1010

1111
$_baseurl = pick($postgresql::repo::baseurl, $default_baseurl)
1212

13+
# Puppet still supports Ubuntu 18.04, but Postgresql no longer provides
14+
# specific builds for it. Use the equivalent Debian release.
15+
$_release = $facts['os']['distro']['codename'] ? {
16+
'bionic' => 'buster',
17+
/(.+)/ => $1,
18+
}
19+
1320
apt::pin { 'apt_postgresql_org':
1421
originator => 'apt.postgresql.org',
1522
priority => 500,
1623
}
1724
-> apt::source { 'apt.postgresql.org':
1825
location => $_baseurl,
19-
release => "${facts['os']['distro']['codename']}-pgdg",
26+
release => $_release,
2027
repos => 'main',
2128
architecture => $facts['os']['architecture'],
2229
key => {

spec/classes/repo_spec.rb

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,25 @@
33
require 'spec_helper'
44

55
describe 'postgresql::repo' do
6-
include_examples 'Debian 11'
6+
context 'on debian 11' do
7+
include_examples 'Debian 11'
78

8-
describe 'with no parameters' do
9-
it 'instantiates apt_postgresql_org class' do
10-
expect(subject).to contain_class('postgresql::repo::apt_postgresql_org')
9+
describe 'with no parameters' do
10+
it 'instantiates apt_postgresql_org class' do
11+
expect(subject).to contain_class('postgresql::repo::apt_postgresql_org')
12+
end
13+
14+
it { is_expected.to contain_apt__source('apt.postgresql.org').with_release(facts[:os]['distro']['codename']) }
15+
16+
it { is_expected.to contain_apt__pin('apt_postgresql_org') }
17+
end
18+
end
19+
20+
context 'on ubuntu 18.04' do
21+
include_examples 'Ubuntu 18.04'
22+
23+
describe 'with no parameters' do
24+
it { is_expected.to contain_apt__source('apt.postgresql.org').with_release('buster') }
1125
end
1226
end
1327
end

0 commit comments

Comments
 (0)