Skip to content

Commit 442853d

Browse files
matonbHelen
authored andcommitted
Allow order parameter to be string value (#893)
* Allow order parameter to be string value concat::fragment accepts either a string or integer as order parameter value. Numeric ordering doesn't work once converted to string filenames: 20 sequential fragments for example | Numeric (no padding) | String (0 Zero Padded) | |----------------------|------------------------| | 10_fragment | 001_fragment | | 11_fragment | 002_fragment | | ... | | | 19_fragment | 010_fragment | | 1_fragment | 011_fragment | | 20_fragment | 012_fragment | | 2_fragment | 013_fragment | | 3_fragment | 014_fragment | Order has gone to pot... * Allow order parameter to be string value concat::fragment accepts either a string or integer as order parameter value. Numeric ordering doesn't work once converted to string filenames: 20 sequential fragments for example | Numeric (no padding) | String (0 Zero Padded) | |----------------------|------------------------| | 10_fragment | 001_fragment | | 11_fragment | 002_fragment | | ... | | | 19_fragment | 010_fragment | | 1_fragment | 011_fragment | | 20_fragment | 012_fragment | | 2_fragment | 013_fragment | | 3_fragment | 014_fragment | Order has gone to pot... @derbious adding rspec tests to check manage_pg_hba_conf w/ acls removing unneeded test
1 parent c098917 commit 442853d

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

manifests/server/pg_hba_rule.pp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
String $database,
66
String $user,
77
String $auth_method,
8-
Optional[String] $address = undef,
9-
String $description = 'none',
10-
Optional[String] $auth_option = undef,
11-
Integer $order = 150,
8+
Optional[String] $address = undef,
9+
String $description = 'none',
10+
Optional[String] $auth_option = undef,
11+
Variant[String, Integer] $order = 150,
1212

1313
# Needed for testing primarily, support for multiple files is not really
1414
# working.

spec/unit/classes/server/config_spec.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,39 @@ class { 'postgresql::server': }
133133
.with_content(/.include \/usr\/lib64\/systemd\/system\/postgresql-9.5.service/)
134134
end
135135
end
136+
137+
describe 'with managed pg_hba_conf and ipv4acls' do
138+
let (:pre_condition) do
139+
<<-EOS
140+
class { 'postgresql::globals':
141+
version => '9.5',
142+
}->
143+
class { 'postgresql::server':
144+
manage_pg_hba_conf => true,
145+
ipv4acls => [
146+
'hostnossl all all 0.0.0.0/0 reject',
147+
'hostssl all all 0.0.0.0/0 md5'
148+
]
149+
}
150+
EOS
151+
end
152+
let :facts do
153+
{
154+
:osfamily => 'RedHat',
155+
:operatingsystem => 'CentOS',
156+
:operatingsystemrelease => '7.0',
157+
:concat_basedir => tmpfilename('server'),
158+
:kernel => 'Linux',
159+
:id => 'root',
160+
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
161+
:selinux => true,
162+
}
163+
end
164+
it 'should have hba rule default' do
165+
is_expected.to contain_postgresql__server__pg_hba_rule('local access as postgres user')
166+
end
167+
it 'should have hba rule ipv4acls' do
168+
is_expected.to contain_postgresql__server__pg_hba_rule('postgresql class generated rule ipv4acls 0')
169+
end
170+
end
136171
end

0 commit comments

Comments
 (0)