File tree 5 files changed +34
-2
lines changed
5 files changed +34
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ postgresql::repo::baseurl : https://apt-archive.postgresql.org/pub/repos/apt/
3
+ postgresql::repo::release : " %{facts.os.distro.codename}-pgdg-archive"
Original file line number Diff line number Diff line change 60
60
#
61
61
# @param repo_baseurl Sets the baseurl for the PostgreSQL repository. Useful if you host your own mirror of the repository.
62
62
# @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.
63
64
#
64
65
# @param needs_initdb
65
66
# Explicitly calls the initdb operation after the server package is installed and before the PostgreSQL service is started.
150
151
Optional[String[1]] $repo_proxy = undef ,
151
152
Optional[String[1]] $repo_baseurl = undef ,
152
153
Optional[String[1]] $yum_repo_commonurl = undef ,
154
+ Optional[String[1]] $apt_source_release = undef ,
153
155
154
156
Optional[Boolean] $needs_initdb = undef ,
155
157
271
273
proxy => $repo_proxy ,
272
274
baseurl => $repo_baseurl ,
273
275
commonurl => $yum_repo_commonurl ,
276
+ release => $apt_source_release ,
274
277
}
275
278
}
276
279
Original file line number Diff line number Diff line change 1
1
# @api private
2
2
class postgresql::repo (
3
3
Optional[String[1]] $version = undef ,
4
+ Optional[String[1]] $release = undef ,
4
5
Optional[String[1]] $proxy = undef ,
5
6
Optional[String[1]] $baseurl = undef ,
6
7
Optional[String[1]] $commonurl = undef ,
Original file line number Diff line number Diff line change 7
7
# http://www.postgresql.org/download/linux/debian/
8
8
#
9
9
$default_baseurl = ' https://apt.postgresql.org/pub/repos/apt/'
10
-
11
10
$_baseurl = pick($postgresql::repo::baseurl , $default_baseurl )
12
11
12
+ $default_release = " ${facts['os']['distro']['codename']}-pgdg"
13
+ $_release = pick($postgresql::repo::release , $default_release )
14
+
13
15
apt::pin { 'apt_postgresql_org' :
14
16
originator => ' apt.postgresql.org' ,
15
17
priority => 500,
16
18
}
17
19
-> apt::source { ' apt.postgresql.org' :
18
20
location => $_baseurl,
19
- release => " ${facts['os']['distro']['codename']}-pgdg " ,
21
+ release => $_release ,
20
22
repos => ' main' ,
21
23
architecture => $facts [' os' ][' architecture' ],
22
24
key => {
Original file line number Diff line number Diff line change 9
9
it 'instantiates apt_postgresql_org class' do
10
10
expect ( subject ) . to contain_class ( 'postgresql::repo::apt_postgresql_org' )
11
11
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
+ }
12
35
end
13
36
end
You can’t perform that action at this time.
0 commit comments