Skip to content

Commit ca4e32a

Browse files
committed
Add new common repo which contains add-ons
Details in https://yum.postgresql.org/news/new-repo-rpms-released/
1 parent 556e6c9 commit ca4e32a

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

manifests/globals.pp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
# @param repo_proxy Sets the proxy option for the official PostgreSQL yum-repositories only.
5757
#
5858
# @param repo_baseurl Sets the baseurl for the PostgreSQL repository. Useful if you host your own mirror of the repository.
59+
# @param repo_commonurl Sets the url for the PostgreSQL common repository. Useful if you host your own mirror of the repository.
5960
#
6061
# @param needs_initdb Explicitly calls the initdb operation after the server package is installed and before the PostgreSQL service is started.
6162
#
@@ -132,6 +133,7 @@
132133
$postgis_version = undef,
133134
$repo_proxy = undef,
134135
$repo_baseurl = undef,
136+
$repo_commonurl = undef,
135137

136138
$needs_initdb = undef,
137139

@@ -256,9 +258,10 @@
256258
# Setup of the repo only makes sense globally, so we are doing this here.
257259
if($manage_package_repo) {
258260
class { 'postgresql::repo':
259-
version => $globals_version,
260-
proxy => $repo_proxy,
261-
baseurl => $repo_baseurl,
261+
version => $globals_version,
262+
proxy => $repo_proxy,
263+
baseurl => $repo_baseurl,
264+
commonurl => $repo_commonurl,
262265
}
263266
}
264267
}

manifests/repo.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
$version = undef,
44
$proxy = undef,
55
$baseurl = undef,
6+
$commonurl = undef,
67
) {
78
case $::osfamily {
89
'RedHat', 'Linux': {

manifests/repo/yum_postgresql_org.pp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
$label2 = 'rhel'
2121
}
2222
$default_baseurl = "https://download.postgresql.org/pub/repos/yum/${postgresql::repo::version}/${label1}/${label2}-\$releasever-\$basearch"
23+
$default_commonurl = "https://download.postgresql.org/pub/repos/yum/common/${label1}/${label2}-\$releasever-\$basearch"
2324

2425
$_baseurl = pick($postgresql::repo::baseurl, $default_baseurl)
26+
$_commonurl = pick($postgresql::repo::commonurl, $default_commonurl)
2527

2628
yumrepo { 'yum.postgresql.org':
2729
descr => "PostgreSQL ${postgresql::repo::version} \$releasever - \$basearch",
@@ -32,5 +34,14 @@
3234
proxy => $postgresql::repo::proxy,
3335
}
3436

37+
yumrepo { 'pgdg-common':
38+
descr => "PostgreSQL common RPMs \$releasever - \$basearch",
39+
baseurl => $_commonurl,
40+
enabled => 1,
41+
gpgcheck => 1,
42+
gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-${package_version}",
43+
proxy => $postgresql::repo::proxy,
44+
}
45+
3546
Yumrepo['yum.postgresql.org'] -> Package<|tag == 'puppetlabs-postgresql'|>
3647
}

spec/unit/classes/globals_spec.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,19 @@
7171
'enabled' => '1',
7272
'proxy' => 'http://proxy-server:8080',
7373
)
74+
is_expected.to contain_yumrepo('pgdg-common').with(
75+
'enabled' => '1',
76+
'proxy' => 'http://proxy-server:8080',
77+
)
7478
end
7579
end
7680

7781
describe 'repo_baseurl on RHEL => mirror.localrepo.com' do
7882
let(:params) do
7983
{
8084
manage_package_repo: true,
81-
repo_baseurl: 'http://mirror.localrepo.com',
85+
repo_baseurl: 'http://mirror.localrepo.com/pgdg-postgresql',
86+
repo_commonurl: 'http://mirror.localrepo.com/pgdg-common',
8287
}
8388
end
8489

@@ -89,7 +94,11 @@
8994
it do
9095
is_expected.to contain_yumrepo('yum.postgresql.org').with(
9196
'enabled' => '1',
92-
'baseurl' => 'http://mirror.localrepo.com',
97+
'baseurl' => 'http://mirror.localrepo.com/pgdg-postgresql',
98+
)
99+
is_expected.to contain_yumrepo('pgdg-common').with(
100+
'enabled' => '1',
101+
'baseurl' => 'http://mirror.localrepo.com/pgdg-common',
93102
)
94103
end
95104
end

0 commit comments

Comments
 (0)