File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 142
142
$_hash = if $hash {
143
143
$hash
144
144
} elsif $connect_settings != undef and ' DBVERSION' in $connect_settings {
145
- if ( versioncmp($version , ' 14' ) >= 0) { ' scram-sha-256' } else { undef }
145
+ versioncmp($version , ' 14' ) ? { - 1 => ' md5 ' , default => ' scram-sha-256' }
146
146
} else {
147
147
$postgresql::server::password_encryption
148
148
}
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper_acceptance'
4
+
5
+ describe 'postgresql::server::role' do
6
+ let ( :user ) { 'foo' }
7
+ let ( :password ) { 'bar' }
8
+
9
+ it 'with different DBVERSION in connect_settings' do
10
+ pp_role = <<-MANIFEST
11
+ $user = '#{ user } '
12
+ $password = '#{ password } '
13
+
14
+ class { 'postgresql::server': }
15
+
16
+ postgresql::server::role { $user:
17
+ password_hash => $password,
18
+ connect_settings => {
19
+ 'DBVERSION' => '13',
20
+ },
21
+ }
22
+ MANIFEST
23
+
24
+ if Gem ::Version . new ( postgresql_version ) >= Gem ::Version . new ( '14' )
25
+ idempotent_apply ( pp_role )
26
+
27
+ # verify that password_encryption selectio is based on 'DBVERSION' and not on postgresql::serverglobals::version
28
+ psql ( "--command=\" SELECT 1 FROM pg_shadow WHERE usename = '#{ user } ' AND passwd = 'md596948aad3fcae80c08a35c9b5958cd89'\" " ) do |r |
29
+ expect ( r . stdout ) . to match ( %r{\( 1 row\) } )
30
+ expect ( r . stderr ) . to eq ( '' )
31
+ end
32
+ end
33
+ end
34
+ end
You can’t perform that action at this time.
0 commit comments