Skip to content

Commit 7b37113

Browse files
committed
WIP
1 parent 5ef6751 commit 7b37113

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

manifests/globals.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@
269269
proxy => $repo_proxy,
270270
baseurl => $repo_baseurl,
271271
}
272-
} elsif $manage_dnf_module {
272+
}
273+
274+
if $manage_dnf_module {
273275
class { 'postgresql::dnfmodule':
274276
ensure => $globals_version,
275277
}

manifests/params.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
$version_parts = split($version, '[.]')
4242
$package_version = "${version_parts[0]}${version_parts[1]}"
4343

44-
if $version == $postgresql::globals::default_version and $facts['os']['name'] != 'Amazon' {
44+
if $version == $postgresql::globals::default_version and $facts['os']['name'] != 'Amazon' or $postgresql::globals::manage_dnf_module {
4545
$client_package_name = pick($client_package_name, 'postgresql')
4646
$server_package_name = pick($server_package_name, 'postgresql-server')
4747
$contrib_package_name = pick($contrib_package_name,'postgresql-contrib')

spec/unit/classes/server_spec.rb

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@
3636
end
3737

3838
describe 'with manage_dnf_module true' do
39+
let(:facts) do
40+
{
41+
os: {
42+
family: 'RedHat',
43+
name: 'RedHat',
44+
release: { 'full' => '8.3', 'major' => '8' },
45+
selinux: {
46+
enabled: true,
47+
}
48+
},
49+
osfamily: 'RedHat',
50+
}
51+
end
52+
3953
let(:pre_condition) do
4054
<<-PUPPET
4155
class { 'postgresql::globals':
@@ -44,7 +58,22 @@ class { 'postgresql::globals':
4458
PUPPET
4559
end
4660

47-
it { is_expected.to contain_package('postgresql dnf module').that_comes_before('Package[postgresql-server]') }
61+
it { is_expected.to contain_package('postgresql dnf module').with_ensure('10').that_comes_before('Package[postgresql-server]') }
62+
it { is_expected.to contain_package('postgresql-server').with_name('postgresql-server') }
63+
64+
describe 'with version set' do
65+
let(:pre_condition) do
66+
<<-PUPPET
67+
class { 'postgresql::globals':
68+
manage_dnf_module => true,
69+
version => '12',
70+
}
71+
PUPPET
72+
end
73+
74+
it { is_expected.to contain_package('postgresql dnf module').with_ensure('12').that_comes_before('Package[postgresql-server]') }
75+
it { is_expected.to contain_package('postgresql-server').with_name('postgresql-server') }
76+
end
4877
end
4978

5079
describe 'service_ensure => running' do

0 commit comments

Comments
 (0)