File tree Expand file tree Collapse file tree 5 files changed +133
-4
lines changed Expand file tree Collapse file tree 5 files changed +133
-4
lines changed Original file line number Diff line number Diff line change 152
152
$password_encryption = $postgresql::params::password_encryption,
153
153
$extra_systemd_config = $postgresql::params::extra_systemd_config,
154
154
155
- Hash[String, Hash] $roles = {},
156
- Hash[String, Any] $config_entries = {},
157
- Hash[String, Hash] $pg_hba_rules = {},
155
+ Hash[String, Hash] $roles = {},
156
+ Hash[String, Any] $config_entries = {},
157
+ Postgresql::Pg_hba_rules $pg_hba_rules = {},
158
158
159
159
Boolean $backup_enable = $postgresql::params::backup_enable ,
160
160
Hash $backup_options = {},
204
204
}
205
205
}
206
206
207
- $pg_hba_rules .each |$rule_name , $rule | {
207
+ $pg_hba_rules .each |String[1] $rule_name , Postgresql::Pg_hba_rule $rule | {
208
208
postgresql::server::pg_hba_rule { $rule_name:
209
209
* => $rule ,
210
210
}
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'Postgresql::Pg_hba_rule' do
6
+ context 'base valid required data' do
7
+ let :data do
8
+ {
9
+ description : 'pc' ,
10
+ type : 'host' ,
11
+ database : 'all' ,
12
+ user : 'all' ,
13
+ address : '127.0.0.1/32' ,
14
+ auth_method : 'md5' ,
15
+ target : '/foo.conf' ,
16
+ postgresql_version : '14' ,
17
+ order : 3
18
+ }
19
+ end
20
+
21
+ it { is_expected . to allow_value ( data ) }
22
+ end
23
+ context 'invalid data' do
24
+ let :data do
25
+ {
26
+ description : 'pc' ,
27
+ type : 'host' ,
28
+ database : 'all' ,
29
+ user : 'all' ,
30
+ address : '/32' ,
31
+ auth_method : 'md5' ,
32
+ target : '/foo.conf' ,
33
+ postgres_version : '14'
34
+ }
35
+ end
36
+
37
+ it { is_expected . not_to allow_value ( data ) }
38
+ end
39
+ context 'empty data' do
40
+ let :data do
41
+ { }
42
+ end
43
+
44
+ it { is_expected . not_to allow_value ( data ) }
45
+ end
46
+ end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'Postgresql::Pg_hba_rules' do
6
+ context 'base valid required data' do
7
+ let :data do
8
+ {
9
+ foo : {
10
+ description : 'pc' ,
11
+ type : 'host' ,
12
+ database : 'all' ,
13
+ user : 'all' ,
14
+ address : '127.0.0.1/32' ,
15
+ auth_method : 'md5' ,
16
+ target : '/foo.conf' ,
17
+ postgresql_version : '14' ,
18
+ order : 1 ,
19
+ } ,
20
+ foo2 : {
21
+ description : 'pc' ,
22
+ type : 'host' ,
23
+ database : 'all' ,
24
+ user : 'all' ,
25
+ address : '127.0.0.1/32' ,
26
+ auth_method : 'md5' ,
27
+ target : '/foo.conf' ,
28
+ postgresql_version : '14' ,
29
+ order : 2
30
+ }
31
+ }
32
+ end
33
+
34
+ it { is_expected . to allow_value ( data ) }
35
+ end
36
+ context 'empty' do
37
+ let :data do
38
+ { }
39
+ end
40
+
41
+ it { is_expected . to allow_value ( data ) }
42
+ end
43
+ context 'invalid data' do
44
+ let :data do
45
+ {
46
+ description : 'pc' ,
47
+ type : 'host' ,
48
+ database : 'all' ,
49
+ user : 'all' ,
50
+ address : '/32' ,
51
+ auth_method : 'md5'
52
+ }
53
+ end
54
+
55
+ it { is_expected . not_to allow_value ( data ) }
56
+ end
57
+ context 'empty value' do
58
+ let :data do
59
+ {
60
+ foo : { }
61
+ }
62
+ end
63
+
64
+ it { is_expected . not_to allow_value ( data ) }
65
+ end
66
+ end
Original file line number Diff line number Diff line change
1
+ # @summary type for all parameters in the postgresql::server::hba_rule defined resource
2
+ # @see https://github.com/puppetlabs/puppetlabs-postgresql/blob/main/manifests/server/pg_hba_rule.pp
3
+ type Postgresql::Pg_hba_rule = Struct[{
4
+ Optional[description] => String,
5
+ type => Postgresql::Pg_hba_rule_type,
6
+ database => String,
7
+ user => String,
8
+ Optional[address] => Optional[Postgresql::Pg_hba_rule_address],
9
+ auth_method => String,
10
+ Optional[auth_option] => Optional[String],
11
+ Optional[order] => Variant[String,Integer],
12
+ Optional[target] => Stdlib::Absolutepath,
13
+ Optional[postgresql_version] => String,
14
+ }]
Original file line number Diff line number Diff line change
1
+ # @summary validates a hash of entries for postgresql::server::pg_hab_conf
2
+ # @see https://github.com/puppetlabs/puppetlabs-postgresql/blob/main/manifests/server/pg_hba_rule.pp
3
+ type Postgresql::Pg_hba_rules = Hash[String[1], Postgresql::Pg_hba_rule]
You can’t perform that action at this time.
0 commit comments