File tree Expand file tree Collapse file tree 5 files changed +34
-2
lines changed Expand file tree Collapse file tree 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 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.
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
271273 proxy => $repo_proxy ,
272274 baseurl => $repo_baseurl ,
273275 commonurl => $yum_repo_commonurl ,
276+ release => $apt_source_release ,
274277 }
275278 }
276279
Original file line number Diff line number Diff line change 11# @api private
22class postgresql::repo (
33 Optional[String[1]] $version = undef ,
4+ Optional[String[1]] $release = undef ,
45 Optional[String[1]] $proxy = undef ,
56 Optional[String[1]] $baseurl = undef ,
67 Optional[String[1]] $commonurl = undef ,
Original file line number Diff line number Diff line change 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 => {
Original file line number Diff line number Diff line change 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
1336end
You can’t perform that action at this time.
0 commit comments