Skip to content

Commit

Permalink
fix ubuntu 18.04 invalid repo
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
h0tw1r3 committed Dec 19, 2023
1 parent 26011ea commit bcb9dbb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
9 changes: 8 additions & 1 deletion manifests/repo/apt_postgresql_org.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@

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

# Puppet still supports Ubuntu 18.04, but Postgresql no longer provides
# specific builds for it. Use the equivalent Debian release.
$_release = $facts['os']['distro']['codename'] ? {
'bionic' => 'buster',
/(.+)/ => $1,
}

apt::pin { 'apt_postgresql_org':
originator => 'apt.postgresql.org',
priority => 500,
}
-> apt::source { 'apt.postgresql.org':
location => $_baseurl,
release => "${facts['os']['distro']['codename']}-pgdg",
release => $_release,
repos => 'main',
architecture => $facts['os']['architecture'],
key => {
Expand Down
22 changes: 18 additions & 4 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,25 @@
require 'spec_helper'

describe 'postgresql::repo' do
include_examples 'Debian 11'
context 'on debian 11' do
include_examples 'Debian 11'

describe 'with no parameters' do
it 'instantiates apt_postgresql_org class' do
expect(subject).to contain_class('postgresql::repo::apt_postgresql_org')
describe 'with no parameters' do
it 'instantiates apt_postgresql_org class' do
expect(subject).to contain_class('postgresql::repo::apt_postgresql_org')
end

it { is_expected.to contain_apt__source('apt.postgresql.org').with_release(facts[:os]['distro']['codename']) }

it { is_expected.to contain_apt__pin('apt_postgresql_org') }
end
end

context 'on ubuntu 18.04' do
include_examples 'Ubuntu 18.04'

describe 'with no parameters' do
it { is_expected.to contain_apt__source('apt.postgresql.org').with_release('buster') }
end
end
end

0 comments on commit bcb9dbb

Please sign in to comment.